Splunk Search

How can we create an API call that returns a link to a report?

danielbb
Motivator

We need to call a search via the API and return a link to a report, produced by this call. Is it doable? So, I have something like the following that returns the result set as json, and the requirement is to return it as a link to a report -

 

curl -k -u 'moogsoft_smart_triage_user:xxxxxx' https://<host>:8089/servicesNS/moogsoft_smart_triage_user/search/search/jobs/export -d search="| savedsearch smart_triage_api_test INC=INCxxxx DeviceType=TestDeviceType" -d output_mode=json -d preview=false

 

Tags (1)
0 Karma

aokur_splunk
Splunk Employee
Splunk Employee

This one is pretty straightforward - keep in mind that the GET request will return in it's response a Search ID (sid).

You can then, in a few minutes, return the results of that SID by just visiting the link, such as:

  • https://<host>:8000/en-US/app/search/search?sid=1686664178.1739

If you would rather have the API pull the results back, send another GET to /<app>/jobs/<sid>/results like this - you can specify options such as output_mode and others:

curl -u admin:changeme \
     -k https://localhost:8089/servicesNS/admin/search/search/jobs/1423855196.339/results/ \
     --get -d output_mode=json -d count=5

 official docs here:

https://docs.splunk.com/Documentation/SplunkCloud/latest/Search/ExportdatausingRESTAPI

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Index This | What travels the world but is also stuck in place?

April 2026 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...