update_config
To update the route configuration, use the route/update_config method. You can create a route with the core/create_route method.
The configuration is replaced completely, not updated field by field. Specify all the fields you need in the request: the fields which aren’t specified are lost. An empty
configobject clears the whole configuration.
Endpoint
svc=route/update_config
params={
"itemId": <long>,
"config": {
"color": <long>,
"descr": <text>,
"units": [<long>]
}
}
Parameters
The request must contain the itemId and config parameters. The contents of the config object aren’t checked by the server, so the fields below are the ones used by the Wialon interface.
| Parameter | Description |
|---|---|
itemId |
Route ID. |
config |
Configuration of the route. |
color |
Color of the route (ARGB). |
descr |
Description of the route. |
units |
Array of the IDs of the units which perform the rides. The IDs aren’t checked, so a nonexistent ID is saved as it is. |
Response
If the request is completed successfully, the saved configuration is returned in the following format:
{
"rcfg": { // Route configuration.
"color": <long>, // Color of the route (ARGB).
"descr": <text>, // Description of the route.
"units": [<long>] // Array of unit IDs.
}
}
The response repeats the configuration from the request, so it contains only the fields which were specified.
If the request fails, an error code is returned.
Error codes
| Error code | Description |
|---|---|
| 4 | Failed to parse the input parameters or to save the configuration. |
| 6 | Failed to generate the response. |
| 7 | The route isn’t found, the specified item isn’t a route, or the user has no Edit route properties access right to it. |