Skip to main content
Skip table of contents

Authentication

Authentication token

All API endpoints requires an authentication token. Retrieve a token by logging to the api with a console user (see Authentication & Authorization).

POST /api/login

Example call to log in:

BASH
curl "http://myindeximacluster:8082/api/login" \
-H "Content-Type: application/json" \
-d "{ "name": "admin", "password": "myPassword" }" 

Example of json response to successful login:

JSON
{
  "id": "HfHqRuIw57pk4TnCOm0nlRMTute4oMsax9KruB9IWDtD1ZqG1PBxMtJjgG4kY241",
  "userName": "admin",
  "isAdministrator": true,
  "localUser": false,
  "createdAt": 1667027559965
}

The response contains the authentication token you will use to access any API endpoint. The id is the token to be used afterwards.

Example call to automate token retrieval:

CODE
ACCESS_TOKEN=$(curl "http://myindeximacluster:8082/api/login" \
  -H 'Content-Type: application/json' \
  -d '{"name":"admin","password":"myPassword"}' \
  | jq -r '.id')

Calling an API endpoint

Once you retrieved an authentication token, you can call any API endpoint by providing the token in the authentication header.
For api endpoint that requires a call to a node (the endpoints starting with /api/monitor), you also need to provide the host and monitoring port of one of the node in header. Those host and port are the one of the node that will handle the api request.
You also need to provide the --compressed parameter for curl to handle zip decompression.

CODE
curl http://myindeximacluster:8082/api/monitor/get/version \
  -H "Authorization: $ACCESS_TOKEN" \
  -H "Monitor-Target-Host: indexima-core-1" \
  -H "Monitor-Target-Port: 9999" \
  --compressed

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.