Splunk Search

Is it possible to call Splunk RestAPI with request in JSON?

jakubvojacek
Loves-to-Learn

Hello all,

is it possible to call Splunk RestAPI with request in JSON.

I am trying in SOAP UI software, media Type = application/json

And when request is inputed as string:
search=search index=myindex |head 5

I get valid response

But when I try request in json format
{"search": "search index=myindex |head 5"}

I get response:
{"messages": [{
"type": "FATAL",
"text": "Empty search."
}]}

Tried also following requests:
{"search": "index=myindex |head 5"}
{"search": search index=myindex |head 5}
{"body": {"search": "search index=myindex |head 5"}}

Thanks

Tags (2)
0 Karma

Dov1
Observer

Hi,

Did you found solution to your problem? 

I need the same thing, I have a system that can send only post with json.

Thanks 

0 Karma
Get Updates on the Splunk Community!

Updated Data Type Articles, Anniversary Celebrations, and More on Splunk Lantern

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

A Prelude to .conf25: Your Guide to Splunk University

Heading to Boston this September for .conf25? Get a jumpstart by arriving a few days early for Splunk ...

4 Ways the Splunk Community Helps You Prepare for .conf25

.conf25 is right around the corner, and whether you’re a first-time attendee or a seasoned Splunker, the ...