Getting Data In

Why I can't access data from Splunk using REST API?

soldatpetit
New Member

Hello every body!
I'm new and i 'd like to communicate with Splunk by REST API using "curl" comand. I tried some examples here but nothing doesn't work.

Example:

Return a session key for the admin user that can be used in future request operations.

curl -k -u admin:pass  http://localhost:8000/services/auth/login \
    -d username=admin \
    -d password=pass

Normally, it's return something like this:

    <response>
      <sessionKey>[value of session key]</sessionKey>
    </response>

But in my case, i obtain:

This ressource can be found at <a href='http://localhost:8000/en-US/services/auth/login'>

I changed the link by: http://localhost:8000/en-US/services/auth/login but i have the same result. So I decided to test the link directly in the browser. I get:

404 Not Found
Return to Splunk home page
The path '/en-US/services/auth/login' was not found.
View more information about your request (request ID = 5446305e3f3252810) in Search 

You are using localhost:8000, which is connected to splunkd @233537 at https://127.0.0.1:8089 on Tue Oct 21 13:07:26 2014.

Someone can help me? Thanks


Remark: I already changed admin and pass by the right login and I use Splunk 6.1.4

0 Karma
1 Solution

aweitzman
Motivator

The web services are running on a different port than the browser interface. Try:

https://localhost:8089/services/auth/login

in your "curl" command.

View solution in original post

aweitzman
Motivator

The web services are running on a different port than the browser interface. Try:

https://localhost:8089/services/auth/login

in your "curl" command.

soldatpetit
New Member

Thank you very much, you saved me. It works very well. 🙂

0 Karma

_gkollias
Builder

Do you need to create the services directory?

0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...