Getting Data In

What is the syntax of the search term in REST API ?

ppang
Splunk Employee
Splunk Employee

This works:

curl -u admin:changeme -k https://localhost:8089/services/search/jobs -d"search=search 123"

These don't: ( if try to POST the REST API directly .. )

https://localhost:8089/services/search/jobs search search==123 ( Not working )

https://localhost:8089/services/search/jobs/search%20search==123 ( Not working )

https://localhost:8089/services/search/jobs/search%20search%3D123 ( Not working )

https://localhost:8089/services/search/jobs/search%20search=123 ( Not working )

https://localhost:8089/services/search/jobs?search%20search=1 (this one bring something back, but not the XML)

https://localhost:8089/services/search/jobs?search%20search%3D1 (this one bring something back, but not the XML)

What is the syntax, please?
Any suggestion ?

Thx a lot

Tags (2)
0 Karma

ineeman
Splunk Employee
Splunk Employee

This is the regular URL call. Specifically, when you specify query parameters to a URL, you specify them as such:

http://www.example.com/api/your/resource/here?param1=foo&param2=bar

In your case however, to create a search job, you need to POST, and so all the parameters go in the body of the POST request, not in the URL, so it will look like this:

http://www.example.com/services/search/jobs

with the POST body looking like this:
search=search%20123&foo=bar

When you did that with curl, it did this thing automagically.

Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...