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!

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