To work with mobile devices, execute requests using the "devices" API method (determine administrator token before executing the request):
Add a mobile device:
curl -X POST -v '<IP address or DNS server name>/api/v2/devices/' --header 'Content-Type: application/json' -H 'Authorization: Bearer <administrator token>' -d '{"id_string": "<device identifier>", "is_active": <device activity indicator (true/false)>,"os_version": "<Device OS version (ANDROID, IOS, UWP, OTHER)>"}'
The example of response:
{
"id": 5,
"id_string": "device4",
"is_active": true,
"registration_date": "2022-06-06T10:58:03.516823+03:00",
"last_enter": null,
"os_version": "IOS"
}
Get list of mobile devices:
curl -v '<IP address or DNS server name>/api/v2/devices/' --header 'Content-Type: application/json' -H 'Authorization: Bearer <administrator token>'
The example of response:
{
"results": [
{
"id": 1,
"id_string": "1",
"is_active": true,
"registration_date": "2022-06-03T19:50:18.664249+03:00",
"last_enter": "2022-06-03T19:50:18.685897+03:00",
"active_users_count": 1,
"os_version": "OTHER"
},
{
"id": 2,
"id_string": "device",
"is_active": true,
"registration_date": "2022-06-06T10:28:53.677098+03:00",
"last_enter": null,
"active_users_count": 0,
"os_version": "OTHER"
}
]
}
Get information about specific mobile device:
curl -v '<IP address or DNS server name>/api/v2/devices/<requested device identifier>/' --header 'Content-Type: application/json' -H 'Authorization: Bearer <administrator token>'
In the <requested device identifier> substitution use value of the id parameter returned on getting the list of mobile devices.
The example of response:
{
"id": 3,
"id_string": "device2",
"is_active": true,
"registration_date": "2022-06-06T10:29:49.320247+03:00",
"last_enter": null,
"active_users_count": 0,
"os_version": "UWP"
}
Change parameters of specific mobile device:
curl -X PUT -v '<IP address or DNS server name>/api/v2/devices/<requested device identifier>/' --header 'Content-Type: application/json' -H 'Authorization: Bearer <administrator token>' -d '{"id_string": "<device identifier>", "is_active": <device activity indicator (true/false)>,"os_version": "<Device OS version (ANDROID, IOS, UWP, OTHER)>"}'
In the <requested device identifier> substitution use value of the id parameter returned on getting the list of mobile devices.
The example of response:
{
"id": 3,
"id_string": "new_name",
"is_active": false,
"registration_date": "2022-06-06T10:29:49.320247+03:00",
"last_enter": null,
"active_users_count": 0,
"os_version": "ANDROID"
}
Get list of API users linked with specific mobile device:
curl -v '<IP address or DNS server name>/api/v2/devices/<identifier or requested device>/api-users/' --header 'Content-Type: application/json' -H 'Authorization: Bearer <administrator token>'
In the <requested device identifier> substitution use value of the id parameter returned on getting the list of mobile devices.
The example of response:
{
"results": [
{
"id": 6,
"environment_name": "environment",
"project_name": "project",
"username": "user11",
"devices_count": 1,
"is_active": true
},
{
"id": 7,
"environment_name": "environment",
"project_name": "project",
"username": "user22",
"devices_count": 1,
"is_active": true
}
]
}
Delete link between API user and mobile device:
curl -X DELETE -v '<IP address or DNS server name>/api/v2/devices/<requested device identifier>/api-users/<user identifier>/' --header 'Content-Type: application/json' -H 'Authorization: Bearer <administrator token>'
In the <requested device identifier> substitution use value of the id parameter returned on getting the list of mobile devices, and in the <user identifier> substitution use value of the username parameter returned on getting the list of API users.
The example of response:
204
Delete mobile device:
curl -X DELETE -v '<IP address or DNS server name>/api/v2/devices/<requested device identifier>/' --header 'Content-Type: application/json' -H 'Authorization: Bearer <administrator token>'
In the <requested device identifier> substitution use value of the id parameter returned on getting the list of mobile devices.
The example of response:
204
See also: