API Examples
The full Device Locator API description is available in the API Explorer.
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": {
"horizontalAccuracy": 1220,
"horizontalConfidenceLevel": 0.68
}
},
{
"sampleTime": "2024-05-03T02:10:17.798Z",
"coordinate": [
24.16717529296875,
56.97748947143555
],
"source": "CellTower",
"metadata": {
"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": {
"horizontalAccuracy": 1220,
"horizontalConfidenceLevel": 0.68
}
}
],
"pageAmount": 1,
"page": 1
}
⚠️ Note that metadata
parameter with accuracy data is only available in Advanced CellTower locator mode.
⚠️ Note that only one latest position is possible for a single device independent of source: either Celltower or GPS. This means that source
query parameter selection can lead to no latest position returned for some devices.
Get Device Activity
Get Cell location resolutions for one device (maximum of last 7 days, defaults to 1 day).
Get a list of location resolutions for device with id 1234567890123456789
ordered by sampleTime DESC:
curl -X GET "https://api.1nce.com/management-api/v1/locate/devices/1234567890123456789/activity"
The response could be 200 OK
with body:
{
"items": [
{
"iccid": "1234567890123456789",
"sampleTime": "2024-05-03T11:00:24.985Z",
"towerMetadata": {
"MCC": "247",
"MNC": "1",
"LAC": "11",
"CellID": "9511"
},
"towerLocation": {
"longitude": 24.16962242126465,
"latitude": 56.97812271118164
},
"resolutionMetadata": {
"horizontalAccuracy": 1220,
"horizontalConfidenceLevel": 0.68
},
"radioAccessType": "2G",
"resolutionMode": "ADVANCED",
"locationResolutionStatus": "SUCCEEDED"
},
{
"iccid": "1234567890123456789",
"sampleTime": "2024-05-03T11:00:24.985Z",
"towerLocation": {
"longitude": 24.16962242126465,
"latitude": 56.97812271118164
},
"radioAccessType": "2G",
"resolutionMode": "BASIC",
"locationResolutionStatus": "SUCCEEDED"
},
{
"iccid": "1234567890123456789",
"sampleTime": "2024-05-03T10:00:24.985Z",
"towerMetadata": {
"MCC": "247",
"MNC": "1",
"LAC": "11",
"CellID": "9511"
},
"radioAccessType": "2G",
"resolutionMode": "ADVANCED",
"locationResolutionStatus": "FAILED"
},
{
"iccid": "1234567890123456789",
"sampleTime": "2024-05-03T09:00:24.985Z",
"radioAccessType": "2G",
"resolutionMode": "BASIC",
"locationResolutionStatus": "FAILED"
}
]
}
⚠️ Note that towerMetadata
and resolutionMetadata
parameters with accuracy data and tower identifier are only available in Advanced CellTower locator mode.
⚠️ Note that, regardless of the different radio access technology types, the LAC
property in the towerMetadata
object can represent TAC
.
OpenCelliD Project is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License
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 16 days ago