A 'Unit' is a fundamental entity created within a client's account to which the tracker is connected. Consequently, all messages transmitted by the tracker to a specific IP and port are directly associated with the unit.
The IP and port can be obtained using GET /partner/units/{id}/channel method.
When creating unit, it is essential to specify a unique ID along with an appropriate hardware ID.
In our applications, the hardware ID represents the type of device selected during unit creation. This allows the tracker to connect to the platform seamlessly. The list of all devices with their hardware IDs can be retrieved using the GET /client/hardware/devices method.
This endpoint is used to create a unit and attach it to the account.
POST /partner/units
The mandatory field for this request:
Request example:
curl -X 'POST' \
'https://api.gps-trace.com/partner/units' \
-H 'accept: application/json' \
-H 'X-AccessToken: <your token>' \
-H 'Content-Type: application/json' \
-d '{
"description": "Unit description",
"name": "Unit_name",
"ident": "string",
"hw_id": 40372386,
"app_id": "b901da51-ce00-4af2-b978-8d0fca8ae1ea",
"account_id": <account id>
}'
201 Response example:
{
"data": {
"name": "Unit_name",
"device_type_id": 725,
"cid": number,
"protocol_id": 13,
"channel_id": number,
"id": number,
"hw_id": number,
"tls": false,
"last_active": null,
"messages_ttl": number,
"messages_rotate": number,
"description": "123Unit description",
"extra_data": [],
"tokens": {},
"created_at": number,
"updated_at": number,
"app_id": "b901da51-ce00-4af2-b978-8d0fca8ae1ea",
"b_type": null,
"completed": null,
"ready": null,
"account_id": number,
"ident": "string"
}
}
This endpoint lets you get the list of units.
GET /partner/units
200 Response example:
{
"data": [
{
"name": "test_unit",
"device_type_id": 725,
"cid": number,
"channel_id": number,
"id": number,
"hw_id": 40372386,
"tls": false,
"last_active": null,
"messages_ttl": number,
"messages_rotate": number,
"description": "Test_description",
"extra_data": null,
"tokens": null,
"created_at": number,
"updated_at": number,
"app_id": "b901da51-ce00-4af2-b978-8d0fca8ae1ea",
"b_type": null,
"completed": null,
"ready": null,
"account_id": number,
"ident": "string"
},
This endpoint lets you get unit information by ID.
GET /partner/units/{id}
The mandatory fields for this request are as follows:
200 Response example:
{
"data": {
"name": "My Queclink GV75",
"device_type_id": 147,
"cid": number,
"channel_id": number,
"id": number,
"hw_id": 862684660,
"tls": false,
"last_active": null,
"messages_ttl": number,
"messages_rotate": number,
"description": "",
"extra_data": [
{
"label": "My SIM",
"showOnCard": true,
"value": "88888888888",
"icon": "t-icon-telephone"
}
],
"tokens": null,
"created_at": number,
"updated_at": number,
"app_id": "b901da51-ce00-4af2-b978-8d0fca8ae1ea",
"b_type": null,
"account_id": number,
"ident": "string"
}
}
This endpoint is used to update unit by ID.
PATCH /partner/units/{id}
The mandatory fields for this request are as follows:
It is important to note that Ruhavik/Petovik accounts, once activated by the client, become fully owned by the client. Therefore, partners cannot update activated Ruhavik/Petovik units.
On the other hand, Forguard accounts are fully managed by the partner and do not have any restrictions on actions from the partner's side.
When using this method, you can modify the following fields:
Request example:
curl -X 'PATCH' \
'https://api.gps-trace.com/partner/units/<unit id>' \
-H 'accept: application/json' \
-H 'X-AccessToken: <your token>' \
-H 'Content-Type: application/json' \
-d '{
"description": "new_description",
"name": "new_unit_name",
"ident": "string",
"hw_id": 19671936
}'
200 Response example:
{
"data": {
"name": "new_unit_name",
"device_type_id": 122,
"cid": number,
"channel_id": number,
"id": number,
"hw_id": 19671936,
"tls": false,
"last_active": null,
"messages_ttl": number,
"messages_rotate": number,
"description": "new_description",
"extra_data": null,
"tokens": null,
"created_at": number,
"updated_at": number,
"app_id": "5a5ca87f-7cbe-4540-ab5d-77bf4bf69884",
"b_type": null,
"completed": null,
"ready": null,
"account_id": number,
"ident": "string"
}
}
This endpoint allows to remove unit by ID.
It is important to note that Ruhavik/Petovik accounts, once activated by the client, become fully owned by the client. Therefore, partners cannot update activated Ruhavik/Petovik units.
On the other hand, Forguard accounts are fully managed by the partner and do not have any restrictions on actions from the partner's side.
DELETE /partner/units/{id}
Request example:
curl -X 'DELETE' \
'https://api.gps-trace.com/partner/units/<unit id>' \
-H 'accept: */*' \
-H 'X-AccessToken: <your token>'
Upon successful deletion, a response with status code 200 will be returned.
This method allows you to retrieve the count of units based on the filtering conditions specified in the request (e.g., all units, units with access to a specific application, active units or no, units of attached or unattached accounts)
GET/partner/units/count
Request body example:
curl -X 'GET' \
'https://api.gps-trace.com/partner/units/count?ack_active=true&app_id=b901da51-ce00-4af2-b978-8d0fca8ae1ea' \
-H 'accept: application/json' \
-H 'X-AccessToken: <your token>'
In the provided example request, units from activated accounts (ack_active=true) in the Forguard application (app_id=b901da51-ce00-4af2-b978-8d0fca8ae1ea) are counted.
The response includes the total count of units according to the specified filter conditions.
200 Response example:
{
"data": {
"all": 4,
"active": 3
}
}
This method allows you to retrieve messages from a device (unit).
GET /partner/units/{id}/messages
The maximum number of messages that can be retrieved is 10,000. You can also specify the number of recent messages you want to obtain.
It is important to note that Ruhavik/Petovik accounts, once activated by the client, become fully owned by the client. Therefore, partners cannot get messages from units on activated Ruhavik/Petovik accounts.
On the other hand, Forguard accounts are fully managed by the partner and do not have any restrictions on actions from the partner's side.
Request example (get the last 10 messages)
curl -X 'GET' \
'https://api.gps-trace.com/partner/units/<unit id>/messages?count=10' \
-H 'accept: application/json' \
-H 'X-AccessToken: <your token>'
Example of success response:
{
"data": [
{
"ain.12": 14765,
"ain.2": 55.5867,
"channel.id": 10664,
"custom.0g": 16,
"custom.battery.level": 100,
"custom.gsm_lvl": 96,
"custom.in1": 1,
"custom.in5": 1,
"custom.in6": 1,
"custom.in7": 1,
"custom.in8": 1,
"custom.odo": 535.546997,
"custom.ta": 10,
"custom.wln_brk_max": 0.05,
"device.id": 5459437,
"device.name": "HG-3365",
"device.type.id": 14,
"engine.ignition.status": true,
"gsm.lac": 18508,
"gsm.mcc": 262,
"gsm.mnc": 1,
"ident": "string",
"peer": "string",
"position.altitude": 46,
"position.direction": 320,
"position.hdop": 1,
"position.latitude": number,
"position.longitude": number,
"position.satellites": 15,
"position.speed": 76,
"protocol.id": 15,
"server.timestamp": number,
"timestamp": number
},...
]
}
The fields in the response will depend on the parameters sent by the tracker.
This endpoint lets you get latest unit telemetry data.
It is important to note that Ruhavik/Petovik accounts, once activated by the client, become fully owned by the client. Therefore, partners can get information of unit messages on activated Ruhavik/Petovik accounts only if the client has enabled Service mode.
On the other hand, Forguard accounts are fully managed by the partner and do not have any restrictions on actions from the partner's side.
GET /partner/units/{id}/telemetry
Request example:
curl -X 'GET' \
'https://api.gps-trace.com/partner/units/<unit id>/telemetry' \
-H 'accept: application/json' \
-H 'X-AccessToken: <your token>'
200 Response example:
{
"data": {
"channel.id": {
"ts": 1713977017.812001,
"value": number
},
"device.id": {
"ts": 1713977017.812001,
"value": number
},
"device.name": {
"ts": 1713977017.812001,
"value": "string"
},
"device.type.id": {
"ts": 1713977017.812001,
"value": number
},
"ident": {
"ts": 1713977017.812001,
"value": "string"
},
"position.altitude": {
"ts": 1713977016,
"value": number
},
"position.direction": {
"ts": 1713977016,
"value": number
},
"position.latitude": {
"ts": 1713977016,
"value": number
},
"position.longitude": {
"ts": 1713977016,
"value": number
},
"position.satellites": {
"ts": 1713977016,
"value": number
},
"position.speed": {
"ts": 1713977016,
"value": number
},
"protocol.id": {
"ts": 1713977017.812001,
"value": number
} ...
}
}
The fields in the response will depend on the parameters sent by the tracker.
This endpoint lets you get unit communication channel data.
It is important to note that Ruhavik/Petovik accounts, once activated by the client, become fully owned by the client. Therefore, partners get information of unit channel data on activated Ruhavik/Petovik accounts only if the client has enabled Service mode.
On the other hand, Forguard accounts are fully managed by the partner and do not have any restrictions on actions from the partner's side.
GET /partner/units/{id}/channel
Request example:
curl -X 'GET' \
'https://api.gps-trace.com/partner/units/<unit id>/channel' \
-H 'accept: application/json' \
-H 'X-AccessToken: <your token>'
200 Response example:
{
"data": {
"id": string,
"configuration": null,
"host": "string",
"port": "string",
"ip": "string",
"shortLink": null
}
}