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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

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