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

Do you need to create the services directory?

0 Karma
Get Updates on the Splunk Community!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...