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

Labels (1)
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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...