All requests to the API require authorization. An authorization token must be sent in the header in the following format:
Authorization: Bearer <integrator_token>
.
The authorization token is returned in response to the login request. Please contact edna support for the credentials of the INTEGRATOR
user and use these credentials to retrieve the token.
Once the token expires, all requests you send with it will result in the 401 status code. You can receive a new token by repeating the login request.
Permissions
---- Permissions:PERMIT ALL ----
Curl Example
$ curl 'http://localhost:8080/api/auth/login' -i -X POST \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -d '{ "login" : "integrator_login", "password" : "integrator_password", "locale" : "integrator_locale" }'
Request Parameters
Path | Type | Description |
login | string | Login of the user with the integrator role |
password | string | Password of the user with the integrator role |
locale | string (optional) | Localization of the user (format en /ru ). Not used for the integrator role. |
HTTP Request
POST /api/auth/login HTTP/1.1 Content-Type: application/json Accept: application/json Content-Length: 106 Host: localhost: 8080 { "login": "integrator_login", "password": "integrator_password", "locale": "integrator_locale" }
Response Parameters
Parameter | Type | Description |
userId | long | User ID in edna Chat Center (not used for integrator) |
token | string | User token. You must specify it in the header in all requests from this user that require authorization. |
role | string | User role. The user has certain access depending on the role. |
Example of a Successful HTTP Response
HTTP/1.1 200 OK Vary: Origin Vary: Access-Control-Request-Method Vary: Access-Control-Request-Headers Authorization: Bearer Bearer <integrator_token> Content-Type: application/json Content-Length: 105 { "userId": 1, "login": null, "token": "Bearer <integrator_token>", "role": "OPERATOR" }