Authenticating and Obtaining a Session ID
Before being able to request any data, one needs to authenticate with the API and get a session ID. The session ID can be retrieved either as part of the JSON response, or else as a cookie.
If authentication is not done, further requests will be rejected. If a POST request for a report is done and no authentication has been made, a 401 error code will be returned. If the same request is done using GET, instead of an error, a 302 redirect is returned to the authentication page.
You use the following POST request to authenticate a user by verifying username and password.
This authentication request has the following properties.
Property |
Description |
|||||||||
Request JSON Object |
|
|||||||||
Request Headers |
|
|||||||||
Response Headers |
|
|||||||||
Status Codes |
|
|||||||||
Response JSON Object |
|
Example Request
POST /auth/login HTTP/1.1
Host: api.revulytics.com
Content-Type: application/json
Accept: application/json
{
"user": "testuser@test.com",
"password": "mypassword1",
"useCookies": false
}
Example Response
HTTP/1.1 200 OK
Content-Type: application/json
{
"status": "OK",
"sessionId": "VSB8E2BzSC2eZSJm4QmTpA"
}