Getting Data In

How can I search a specific index via the API using curl?

msmapper
Path Finder

How can I search a specific index via the API using curl? When I try to use
curl -u user:pass -k -d 'search=search index="indexname" OR curl -u user:pass -k -d 'search=search index="indexname"

I get results but the following messages returned...
No Matching index found for 'index=indexname'
No mmatching index found for index::indexname

Any help would be appreciated..

Tags (4)
1 Solution

ineeman
Splunk Employee
Splunk Employee

The problem here is because your request isn't URL encoded. Specifically, your:

search index="indexname"

Needs to be URL encoded. You can easily fix this by doing:

curl -k -u admin:changeme https://localhost:8089/services/search/jobs --data-urlencode 'search=search index="_internal" | head 1'

View solution in original post

ineeman
Splunk Employee
Splunk Employee

The problem here is because your request isn't URL encoded. Specifically, your:

search index="indexname"

Needs to be URL encoded. You can easily fix this by doing:

curl -k -u admin:changeme https://localhost:8089/services/search/jobs --data-urlencode 'search=search index="_internal" | head 1'
Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...