Splunk Answers-a-thon!

How to use the Splunk REST API?

yeasuh
Splunk Employee
Splunk Employee

How to use the Splunk REST API?

Labels (2)
0 Karma

emottola
Explorer

There's a lot of good documentation on REST APIs for Splunk!
Begin your journey understanding what you can do here:
https://docs.splunk.com/Documentation/Splunk/9.1.0/RESTREF/RESTprolog
and see the index of available endpoints here:
https://docs.splunk.com/Documentation/Splunk/latest/RESTREF/RESTlist

keeping in mind that some endpoints are not available for Splunk Cloud.

The best thing to know is that anything you can do in the UI has a REST endpoint you can (probably) access using REST directly.  Your browser inspector can be your friend!  Use the network tab while interacting with the UI to find out which endpoints UI elements use, and you can learn from the payloads they send to begin testing with the API.

When you want to start using the API, make sure you're targeting the splunk instance you're trying to interact with, and know its role, like a Search Head Cluster member.
Then, try a simple GET on an endpoint you should expect results for, like https://docs.splunk.com/Documentation/Splunk/9.1.0/RESTREF/RESTaccess#authentication.2Fcurrent-conte... 

Your access will depend on your authentication model, but you may need to create or request a REST token from your splunk admins

0 Karma
Get Updates on the Splunk Community!

Developer Spotlight with William Searle

The Splunk Guy: A Developer’s Path from Web to Cloud William is a Splunk Professional Services Consultant with ...

Major Splunk Upgrade – Prepare your Environment for Splunk 10 Now!

Attention App Developers: Test Your Apps with the Splunk 10.0 Beta and Ensure Compatibility Before the ...

Stay Connected: Your Guide to June Tech Talks, Office Hours, and Webinars!

What are Community Office Hours?Community Office Hours is an interactive 60-minute Zoom series where ...