To get an API key, send the POST login request with the login and password:
Get API key created earlier
To get one of the created API keys, specify the parameter value new_key: false or just do not specify the parameter:
curl -X POST https://<IP address/domain name of the server>/api-2.0/login \
-H "Content-Type: application/json" \
-d "{\"login\":\"example@drweb.com\", \"password\":\"secret_password\"}"
|
You receive a response with the API key (the API key is required to be specified in the header of each subsequent request):
{
"new_key": false,
"api_key": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
"start_date": "2019-02-08T04:08:15.162342+00:00"
}
|
Create API key
To create a new API key, specify the parameter value new_key: true (if you have not got any API keys created, you do not have to specify the parameter—API key will be created anyway):
curl -X POST https://<IP address/domain name of the server>/api-2.0/login \
-H "Content-Type: application/json" \
-d "{\"login\":\"example@drweb.com\", \"password\":\"secret_password\", \"new_key\": true, \"name\":\"example_name_api"}"
|
You receive a response with the API key (the API key is required to be specified in the header of each subsequent request):
{
"new_key": true,
"api_key": "bbbbbbbb-cccc-dddd-eeee-ffffffffffff",
"start_date": "2019-03-08T04:08:15.162342+00:00",
"name": "example_name_api"
}
|
|