update_checkpoints
To update the list of the route checkpoints, use the update_checkpoints command:
svc=route/update_checkpoints
params={
"itemId": <long>,
"checkPoints": [
{}
]
}
Parameters
The request must contain the following parameters:
Parameter | Description |
---|---|
itemID | Route ID. |
checkPoints | Array of checkpoints. |
The checkpoint format varies depending on the checkpoint type, that is, on whether it is a checkpoint from the map, a geofence or a unit.
Checkpoints from the map
The format of checkpoits from the map is as follows:
{
"f": 1, // Point type.
"n": <text>, // Name.
"y": <double>, // Latitude.
"x": <double>, // Longitude.
"r": <uint> // Radius.
}
Checkpoints from geofences
For checkpoints from geofences, two formats are possible:
- format 1: with the indication of the gz field, containing the geofence data;
- format 2: with the indication of the resource ID and the geofence ID.
Format 1
{
"f": 2, // Point type.
"n": <text>, // Name.
"gz": { // Geofence information.
"n": <text>, // Geofence name.
"d": <text>, // Geofence description.
"id": <long>, // Geofence ID.
"t": <byte>, // Geofence type: 1 = line, 2 = polygon, 3 = circle.
"w": <uint>, // Line width or circle radius.
"f": <uint>, // Geofence flags.
"c": <uint>, // Color (ARGB).
"b": { // Bounding box parameters.
"min_x": <double>, // Minimum longitude.
"min_y": <double>, // Minimum latitude.
"max_x": <double>, // Maximum longitude.
"max_y": <double>, // Maximum latitude.
"cen_x": <double>, // Center longitude.
"cen_y": <double> // Center latitude.
},
"p": [ // Array of geofence points.
{
"x": <double>, // Longitude.
"y": <double>, // Latitude.
"r": <uint> // Radius.
}
]
}
}
Format 2
{
"f": 2, // Point type.
"n": <text>, // Name.
"resource": <long>, // ID of the resource containing the geofence.
"zone": <long> // Geofence ID within the resource.
}
Checkpoints from units
The format of checkpoits from units is as follows:
{
"f": 4, // Point type.
"u": <long>, // Unit ID.
"r": <uint> // Radius.
}
Response
If the request is completed successfully, the response is returned in the following format:
{
"rpts": [ // Array of checkpoints.
{
"n": <text>, // Name.
"f": <uint>, // Type.
"u": <long>, // Unit ID (0 if the type is not a checkpoint from a unit).
"y": <double>, // Latitude.
"x": <double>, // Longitude.
"r": <uint> // Radius.
}
]
}
If the request fails, an error code is returned.
Error codes
Error Code | Description |
---|---|
4 | Invalid input parameters, or failed to update the checkpoints. |
6 | Failed to create the JSON writer (internal). |
7 | One of the following errors:
|