splunk/splunk-sdk-javascript

oneShotSearch issue

oOBlinkOo opened this issue · 3 comments

Im using the library to create jobs and get the info, it works fine but right now i try to export my results in csv using this:

service.oneshotSearch(query, { output_mode:"csv" }, (err, newJob) => {
  console.log(newjob) // <- this is always json 
})

https://docs.splunk.com/DocumentationStatic/JavaScriptSDK/1.8.4/splunkjs.Service.html#splunkjs.Service-oneshotSearch
show that is posible to send: csv,xml but this is always return json. any idea?

digging in the library i found this in the http.js queryBuilderMap definition:

// if (!utils.startsWith(outputMode, "json")) {
 //     outputMode = "json";
 // }

this always set json, i just commento for the moment or add another validation just to pass the value from csv or xml and it works.

I think that line of code breaks the intended functionality that is documented.

This should be fixed. Unless we are understanding it incorrectly? If I set the format to "CSV" I should receive CSV, right? Not JSON....

Thanks, @oOBlinkOo for registering this issue.
We have made the changes to use output_mode.
Changes will be available in the next release.