Getting Data In

Create Saved Search with Rest API ->need working example

Max_99
New Member

Hi,

Does somebody have a working example of how to create a Saved Search using the Rest API with XML?

Thanks

Max

Labels (1)
0 Karma

isoutamo
SplunkTrust
SplunkTrust

Hi

In linux shell you could do next

UserPass=admin:changeme

curl -ku $up https://localhost:8089/services/search/jobs -d search="search index=_internal earliest=-1m|stats count"
<?xml version="1.0" encoding="UTF-8"?>
<response>
<sid>1593502508.3</sid>
</response>

curl -ku $up https://localhost:8089/services/search/jobs/1593502508.3/results/ --get -d output_mode_xml
<?xml version='1.0' encoding='UTF-8'?>
<results preview='0'>
<meta>
<fieldOrder>
<field>count</field>
</fieldOrder>
</meta>
<result offset='0'>
<field k='count'>
<value><text>275</text></value>
</field>
</result>
</results>
 
r. Ismo

 

0 Karma

isoutamo
SplunkTrust
SplunkTrust
Change curl -ku $up => curl -ku $UserPass
0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

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