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

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...