How to provision a virtual device
You must provision a device before it can send data to the Tracking API.
User login
Login the user into the HERE Tracking API and obtain an accessToken.
Provision devices
When provisioning a virtual device, its owner should create and specify the device id in the provisioning request.
A virtual device id is project-specific. After a virtual device has been provisioned, its id will be referred to as externalId and along with the project appId it can be used to uniquely identify the device.
For more information, see: Creates licenses for multiple devices.
curl -X POST \
https://{tcHost}/registry/v2/{projectAppId}/devices \
-H 'Authorization: Bearer {token}' \
-H 'Content-Type: application/json' \
-d '{
"devices": [
{
"id": "my-first-device"
},
{
"id": "my-second-device"
}
]
}'
{
"jobId": "344a17a4-1b19-4420-bb6f-8400b87071fd"
}The response will be the jobId which can be used to retrieve the results.
Check job progress
For more information, see Gets the multiple device license request job status.
curl -X GET \
'https://{tcHost}/registry/v2/{jobId}/status' \
-H 'Authorization: Bearer {accessToken}' \
-H 'Content-Type: application/json'
{
"percent": 100,
"status": "complete"
}Retrieve device licenses
For more information, see Gets the multiple device license request job results.
curl -X GET \
'https://{tcHost}/registry/v2/{jobId}/results' \
-H 'Authorization: Bearer {accessToken}' \
-H 'Content-Type: application/json'
{
"data": [
{
"deviceId": "VRDE-11111111-2222-3333-4444-555555555555",
"externalId": "my-first-device"
},
{
"deviceId": "VRDE-22222222-2222-3333-4444-555555555555",
"externalId": "my-second-device"
}
],
"count": 2
}List all provisioned devices
For more information, see Lists all the devices provisioned by a user.
curl -X GET \
https://{tcHost}/registry/v2/{projectAppId}/devices \
-H 'Authorization: Bearer {accessToken}' \
-H 'Content-Type: application/json'
{
"count": 2,
"data": [
{
"deviceId": "VRDE-11111111-2222-3333-4444-555555555555",
"externalId": "my-first-device",
"appId": "A1abc2dEFg3HiJKlMN45",
"timestamp": 1718002070189
},
{
"deviceId": "VRDE-22222222-3333-4444-5555-666666666666",
"externalId": "my-second-device",
"appId": "A1abc2dEFg3HiJKlMN45",
"timestamp": 1718002070190
}
]
}This will list all the devices provisioned by a user project identified by the projectAppId.
Next steps
After a device has been provisioned, you can proceed with claiming the device to the user project.
Updated 24 days ago