Splunk Search

Is it possible to use POST and DELETE with "rest" search command?

npichugin
Path Finder

There is a nice search command for interacting with REST API: http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Rest

But it seems that it can only do GET queries. Is it possible to do POST and DELETE queries in search?

To be more specific, I need to dynamically create and remove inputs in my application.

Tags (2)
0 Karma

markbarber21
Path Finder

Yes, you may use a REST call to delete. See DELETE for the "saved/searches/{name}" endpoint.
https://docs.splunk.com/Documentation/Splunk/6.5.1612/RESTREF/RESTsearch#saved.2Fsearches.2F.7Bname....

Please keep in mind that the Splunk Search interface command line provides a 'rest' command, but this is read only, and is not a true REST client. Please use your favorite common purpose REST client. (curl, Postman, any HTTP library)

0 Karma

Ayn
Legend

No, the rest command supports GET requests only.

sowings
Splunk Employee
Splunk Employee

Use something like curl from the command line, or some other framework to issue POST / DELETE requests to the REST API over the network (to the management port of the Splunk instance, default 8089).

0 Karma

cmerriman
Super Champion

here is a doc on using curl in the command line http://docs.splunk.com/Documentation/Splunk/latest/RESTUM/RESTusing

0 Karma

npichugin
Path Finder

Thanks for the clarification!
Is there a way to achieve the same goal without "rest" command then?

0 Karma

dominiquevocat
SplunkTrust
SplunkTrust

Try https://splunkbase.splunk.com/app/2775/ it contains a more generic Splunk REST command 🙂

0 Karma
Get Updates on the Splunk Community!

Fueling your curiosity with new Splunk ILT and eLearning courses

At Splunk Education, we’re driven by curiosity—both ours and yours! That’s why we’re committed to delivering ...

Splunk AI Assistant for SPL 1.1.0 | Now Personalized to Your Environment for Greater ...

Splunk AI Assistant for SPL has transformed how users interact with Splunk, making it easier than ever to ...

Unleash Unified Security and Observability with Splunk Cloud Platform

     Now Available on Microsoft AzureOn Demand Now Step boldly into the AI revolution with enhanced security ...