Create a device license
To create a new device license, you must be a user and have a project. You also need to be the project admin. This means that you have either created a new project in the Admin Portal or you have been granted a membership of an existing Tracking project with the Project Admin role. Each project has a unique appId
, which is needed for provisioning a new device license.
In the Tracking API documentation, a user possessing a provisioned device license, is referred to as the device vendor.
Creating a license
Prerequisites
Log the user in
curl -X POST \
https://tracking.api.here.com/users/v2/login \
-H 'Content-Type: application/json' \
-d '{
"email": "{userEmail}",
"password": "{userPassword}"
}'
This will return a user access token: accessToken
.
Get project's application id
curl -X GET \
'https://tracking.api.here.com/registry/v2/licenses' \
-H 'Authorization: Bearer {accessToken}' \
-H 'Content-Type: application/json'
This will return a list of projects you are a member of. Each project has a unique appId
and projectId
. Pick an appId
and projectId
of a project you want to add the device to. In this guide, we will refer to these parameters as the projectAppId
and projectId
.
Request a single device license
You can request one single device license using this request to the registry endpoint:
curl -X POST \
https://tracking.api.here.com/registry/v2/{projectAppId}/one-device \
-H 'Authorization: Bearer {accessToken}' \
-H 'Content-Type: application/json'
This will return the requested device license – a deviceId
and deviceSecret
.
Request multiple device licenses
Alternatively, you can request multiple device licenses for multiple devices simultaneously. The count
parameter specifies the number of licenses requested. For evaluation purposes, you can create a maximum of 10 device licenses.
Create device license batch request
curl -X POST \
https://tracking.api.here.com/registry/v2/{projectAppId}/devices \
-H 'Authorization: Bearer {accessToken}' \
-H 'Content-Type: application/json' \
-d '{
"count": 5
}'
This will return jobId
which can be used to track the progress of the license creation.
Check job progress
curl -X GET \
'https://tracking.api.here.com/registry/v2/{jobId}/status' \
-H 'Authorization: Bearer {accessToken}' \
-H 'Content-Type: application/json'
This will return a percentage value showing the progress of the license creation job.
Retrieve licenses
curl -X GET \
'https://tracking.api.here.com/registry/v2/{jobId}/results' \
-H 'Authorization: Bearer {accessToken}' \
-H 'Content-Type: application/json'
This will return the device licenses requested.
List all provisioned devices
curl -X GET \
https://tracking.api.here.com/registry/v2/{projectAppId}/devices \
-H 'Authorization: Bearer {accessToken}' \
-H 'Content-Type: application/json'
This will list all the devices provisioned by a user project identified by the projectAppId
.