Skip to content

Commit

Permalink
Merge pull request #106 from Bre77/fix_spl2moduledispatch
Browse files Browse the repository at this point in the history
Fix the spl2-module-dispatch URI to use servicesNS instead of services
  • Loading branch information
JasonConger authored Oct 5, 2023
2 parents a6f7723 + b5f0e1c commit 67068d0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions out/notebooks/splunk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ export function updateSpl2Module(service: any, moduleName: string, namespace: st
}

/**
* Dispatch a module to create a job using the POST /services/<app>/spl2-module-dispatch endpoint
* Dispatch a module to create a job using the POST /servicesNS/-/<app>/search/spl2-module-dispatch endpoint
* @param service Instance of the Javascript SDK Service
* @param spl2Module Full text of the SPL2 module to run (contents of a SPL2 notebook cell, for example)
* @param app App namespace to run within, this will determine /services/<app>/spl2-module-dispatch endpoint
* @param app App namespace to run within, this will determine /servicesNS/-/<app>/search/spl2-module-dispatch endpoint
* @param namespace Namespace _within_ the apps.<app> to run, this will be used directly in the body of the request
* @param earliest Earliest time to be included in the body of the request
* @param latest Latest time to be included in the body of the request
Expand Down Expand Up @@ -166,7 +166,7 @@ export function dispatchSpl2Module(service: any, spl2Module: string, app: string
// The Splunk SDK for Javascript doesn't currently support the spl2-module-dispatch endpoint
// nor does it support sending requests in JSON format (only receiving responses), so
// for now use the underlying needle library that the SDK uses for requests/responses
console.log(`Request: [POST] to ${service.prefix}/services/${encodeURIComponent(app)}/spl2-module-dispatch`);
console.log(`Request: [POST] to ${service.prefix}/servicesNS/-/${encodeURIComponent(app)}/search/spl2-module-dispatch`);
console.log(`Request Body: \n'${JSON.stringify({
'module': spl2Module,
'namespace': namespace,
Expand All @@ -177,7 +177,7 @@ export function dispatchSpl2Module(service: any, spl2Module: string, app: string
console.log(`Request Headers: ${JSON.stringify(makeHeaders(service))}`);
return needle(
'POST',
`${service.prefix}/services/${encodeURIComponent(app)}/spl2-module-dispatch`,
`${service.prefix}/servicesNS/-/${encodeURIComponent(app)}/search/spl2-module-dispatch`,
{
'module': spl2Module,
'namespace': namespace,
Expand Down

0 comments on commit 67068d0

Please sign in to comment.