To authorize in the REST API, use /public/jwt/login method and send the username and MD5 hash of the password.
Here's a sample REST API authorization flow.
1. Authorization
Request:
POST https://your-mdm.com/rest/public/jwt/login
Content-Type: application/json
{
"login": "admin",
"password": "21232F297A57A5A743894A0E4A801FC3"
}
Important notice: the MD5 hash should be uppercase!
Response:
200 OK
{
"id_token": "eyJhbGciOiJIUz..."
}
2. Authorized REST API request
Add the "Authorization" HTTP header.
POST https://your-mdm.com/rest/private/devices/search
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJIUz...
{
"pageSize": 1000000,
"pageNum": 1
}
This will return you the whole list of available devices (the default page size is 100 so you need to specify a larger number to get all devices).
The token lifetime is limited (1 day), so you need to resend the authorization request if you get a 401 error.