Getting Data In

Saved Search REST End Point

lpolo
Motivator

The following URI returns the metadata information related to a saved search named "test" found in application "search":

https://myhost:8089/servicesNS/userid/search/saved/searches/test

I would like to know what will be the URI to run the saved search "test" found in application "search" where the returned data format is in json.

Thanks,
Lp

Tags (1)
0 Karma

lpolo
Motivator

I had to simplify the saved search to make it work. why? I do not know. the original saved search works when I dispatch the saved search and grab the results with the sid.

This is an example:
https://myhost.com:8089/services/search/jobs -d search=" savedsearch test" -d exec_mode=oneshot -d output_mode=json . It worked.

0 Karma

lpolo
Motivator

I am aware of it. I just wanted know if it is possible to get the results of a saved search with a single REST call.

0 Karma

gkanapathy
Splunk Employee
Splunk Employee

That is what you would normally do with any search, even just a hardcoded search string, though I suppose you could run those with exec_mode of blocking or oneshot. If that's what you want to do, you can just get the search string for the saved search and dispatch a job using that string in the desired exec_mode.

0 Karma

gkanapathy
Splunk Employee
Splunk Employee

If you want to run a search, you must also specify the view in which it is run, assuming you want to link to it and run it in the UI. ( If you want to just schedule and run in the background without UI, you can use the REST call http://docs.splunk.com/Documentation/Splunk/latest/RESTAPI/RESTsearch#saved.2Fsearches.2F.7Bname.7D.... )

Generally, this URL looks like http://splunkweb:8000/en-US/app/search/flashtimeline?s=test

lpolo
Motivator

It looks like the only way is to dispatch the saved search and then grab the results.
It seems that there is not a way to call the saved search directly, unless; you call the end point to be part of a view like you mentioned.

0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...