Getting Data In

Trying to make Splunk Rest API search request and got 400 bad request

yko84109
Loves-to-Learn

I'm trying to send the following Request body (Using Splunk Rest API, C#):
search = |inputlookup mylookup | eval week_ago=strftime(relativetime(now(), "-7d@d"), "%Y-%m-%d %H:%M:%S") | where record_created>week_ago

Post request to:
https://mysplunkuri:8089/servicesNS/~/search/search/jobs
Headers:
Content-Type: application/x-www-form-urlencoded
Authorization: Basic (base64Stringofmycredentials)

And got 400 bad request.

If I'm trying the following query:
search = |inputlookup mylookup | where record_created>"2019-04-16 00:00:00"

Its return status code 200 (OK).

All the queries above works in splunk.

What I'm doing wrong?

Tags (3)
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 at Splunk .conf24 ...

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 ...