API User Authentication Method

To work with HTTP requests, the API user must be authenticated. Authentication automatically determines a unique identifier that is a user token.

To manually determine a user token, execute request using the "auth" API method:

curl -v '<IP address or DNS name of server>/api/v1/auth/jwt/obtain/' -d "environment=<environment name>&password=<API user password>&username=<API user name>&project=<project name>&device_id=<device identifier>"

The example of response containing user token:

{
    "token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJwcm9qZWN0X2lkIjoxLCJlbnZpcm9ubWVudCI6Im"
}

Example of response with authentication error:

{
    "code": 401,
    "description": "Unauthorized"
}

The example of response with incorrect parameters:

400 Bad Request

Authentication Features

Other API methods do not use user account if request contains cookie files with valid token. When a request is executed without valid token, a response with authentication error is returned.

If the device-Id parameter is set in the request, after successful authentication a device is created in the database and is linked to the current user. The device is created if it has not been created before.

See also:

Server API