API Examples
Location
Get Device Positions
Get positions of a specific device for the last 7 days.
Get a list of positions for device with id 1234567890123456789
:
curl -X GET "https://api.1nce.com/management-api/v1/locate/devices/1234567890123456789/positions"
The response could be 200 OK
with body:
{
"coordinates": [
{
"sampleTime": "2024-05-03T11:00:24.985Z",
"coordinate": [
24.16962242126465,
56.97812271118164
],
"source": "CellTower",
"metadata": {
"timestamp": "2024-05-03T03:22:50.679782819Z",
"horizontalAccuracy": 1220,
"horizontalConfidenceLevel": 0.68
}
},
{
"sampleTime": "2024-05-03T02:10:17.798Z",
"coordinate": [
24.16717529296875,
56.97748947143555
],
"source": "CellTower",
"metadata": {
"timestamp": "2024-05-03T02:19:02.872003169Z",
"verticalAccuracy": 577,
"horizontalAccuracy": 300,
"verticalConfidenceLevel": 0.68,
"horizontalConfidenceLevel": 0.68
}
}
],
"pageAmount": 1,
"page": 1
}
⚠️ Note that metadata
parameter with accuracy data is only available in Advanced CellTower locator mode.
Get Latest Devices Positions
Get latest positions of customer devices for the last 7 days.
curl -X GET "https://api.1nce.com/management-api/v1/locate/positions/latest"
The response could be 200 OK
with body:
{
"coordinates": [
{
"deviceId": "1234567890123456788",
"sampleTime": "2024-05-07T15:40:12.703Z",
"coordinate": [
24.164257049560547,
56.974369049072266
],
"source": "GPS"
},
{
"deviceId": "1234567890123456789",
"sampleTime": "2024-05-03T11:00:24.985Z",
"coordinate": [
24.16962242126465,
56.97812271118164
],
"source": "CellTower",
"metadata": {
"timestamp": "2024-05-03T03:22:50.679782819Z",
"horizontalAccuracy": 1220,
"horizontalConfidenceLevel": 0.68
}
}
],
"pageAmount": 1,
"page": 1
}
⚠️ Note that metadata
parameter with accuracy data is only available in Advanced CellTower locator mode.
Geofence
Create geofence
Create new geofence:
curl -X POST "https://api.1nce.com/management-api/v1/locate/geofences"
The request body looks like this:
{
"eventTypes": [
"ENTER",
"EXIT"
],
"coordinates": [
[
[
6.957239730898948,
50.93892367514573
],
[
6.958509831039635,
50.93836584192053
],
[
6.959702958010666,
50.93945723847878
],
[
6.9596259993105605,
50.934266755623526
],
[
6.961550428436993,
50.93431526288117
],
[
6.961434941100492,
50.94059711468901
],
[
6.959087148954154,
50.94059710732816
],
[
6.957239730898948,
50.93892367514573
]
]
],
"name": "Once"
}
Get Geofence
Get details of a geofence.
Get a details of geofence with id geofence_id_1
:
curl -X GET "https://api.1nce.com/management-api/v1/locate/geofences/geofence_id_1"
The response could be 200 OK
with body:
{
"id": "geofence_id_1",
"name": "Once",
"created": "2024-05-09T10:07:03.062Z",
"updated": "2024-05-09T10:13:48.852Z",
"eventTypes": [
"ENTER"
],
"coordinates": [
[
[
6.957239730898948,
50.93892367514573
],
[
6.958509831039635,
50.93836584192053
],
[
6.959702958010666,
50.93945723847878
],
[
6.9596259993105605,
50.934266755623526
],
[
6.961550428436993,
50.93431526288117
],
[
6.961434941100492,
50.94059711468901
],
[
6.959087148954154,
50.94059710732816
],
[
6.957239730898948,
50.93892367514573
]
]
]
}
Get All Geofences
Get a list of all customer geofences.
curl -X GET "https://api.1nce.com/management-api/v1/locate/geofences"
The response could be 200 OK
with body:
{
"items": [
{
"id": "geofence_id_2",
"name": "home",
"created": "2023-02-23T08:18:32.304Z",
"updated": "2023-02-23T08:18:32.304Z"
},
{
"id": "geofence_id_1",
"name": "Once",
"created": "2024-05-09T10:07:03.062Z",
"updated": "2024-05-09T10:13:48.852Z"
}
],
"page": 1,
"pageAmount": 1
}
Patch Geofence
Update an existing geofence
Change event type of existing geofence to ENTER only for geofence with id geofence_id_1
:
curl -X PATCH "https://api.1nce.com/management-api/v1/locate/geofences/geofence_id_1"
The request body looks like this:
{
"eventTypes": [
"ENTER"
]
}
Delete Geofence
Delete an existing geofence
Delete geofence with id geofence_id_1
:
curl -X DELETE "https://api.1nce.com/management-api/v1/locate/geofences/geofence_id_1"
Updated 3 months ago