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:

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

Example of json response to successful login:

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

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:

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

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.

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
CODE