To work with HTTP requests, the administrator should execute authentication. The authentication automatically determines a unique identifier that is an administrator token.
To determine an administrator token, execute request manually using the "auth" API method:
curl -v -X POST '<IP address or DNS server name>/api/v1/admin/auth/' --header 'Content-Type: application/json' -d '{"username": "<administrator login>", "password": "<administrator password>"}'
The example of response containing administrator token:
{
"token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjU1NDczNDk3LCJpYXQiOjE2NTQyNjM4OTcsImp0aSI6IjkxZjY3NmY1OWViYjQ1OGRiODVlMTAxZDhjMTBlMDNiIiwidXNlcm5hbWUiOiJzdXBlcnVzZXIiLCJpc19zdGFmZiI6dHJ1ZX0.iEwR8L6A4AB68I0iOC8Tuw9THYKukMRm9U19j943ORE",
"refresh_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTY1ODE1MTg5NywiaWF0IjoxNjU0MjYzODk3LCJqdGkiOiI2MmNlZGE4NWI5MDU0ZWM3YWE0MGU1YjA3ZDhlNzg5NyIsInVzZXJuYW1lIjoic3VwZXJ1c2VyIiwiaXNfc3RhZmYiOnRydWV9.Bg5h3FhbRWKiWukZuQ_uBhEjZEh6Kv4s7vUK3QjYwjQ"
}
To change password of the authenticated administrator, execute request using the "change-password" API method:
curl -X POST -v '<IP address or DNS server name>/api/v2/accounts/staff/local/change-password/' --header 'Content-Type: application/json' -H 'Authorization: Bearer <administrator token>' -d '{"password": "<new password>", "confirmed_password": "<repeat new password>", "old_password": "<old password>" }'
The example of response:
200
See also: