update_trailer
To create, edit, or delete trailers, use the resource/update_trailer method.
Endpoint
svc=resource/update_trailer¶ms={
"itemId": <long>,
"id": <long>,
"callMode": <text>,
"n": <text>,
"c": <text>,
"ds": <text>,
"f": <uint>,
"ej": { ... },
"jp": {
<text>: <text>,
...
}
}
Parameters
The request must contain the following parameters:
| Parameter | Description |
|---|---|
itemId |
Resource ID. |
id |
Trailer ID. To create a trailer, send 0. |
callMode |
Action type: create, update, delete, reset_image (delete the trailer image). |
n |
Trailer name. Required only for the create and update action types. |
c |
Trailer code. Required only for the create and update action types. |
ds |
Trailer description. Required only for the create and update action types. |
f |
Flags, not currently used. Optional. |
ej |
Extended JSON. Optional. If the parameter isn’t specified, {} is set when creating a trailer, and the current value is kept when editing it. |
jp |
Custom fields in the "name":"value" format. Optional. If the parameter isn’t specified, the custom fields are cleared. |
Response
If the request for creating or editing the trailer, or deleting its image, is completed successfully, the response is returned in the following format:
[
<long>, /* Trailer ID. */
{
"id": <long>, /* Trailer ID. */
"n": <text>, /* Name. */
"c": <text>, /* Code. */
"ej": { ... }, /* Extended JSON. */
"jp": { /* Custom fields. */
<text>: <text>, /* Name: value. */
...
},
"pwd": <text>, /* Password for mobile authorization (not used for trailers). */
"ds": <text>, /* Description. */
"p": <text>, /* Phone number. */
"r": <double>, /* Image aspect ratio. */
"f": <uint>, /* Flags. */
"ck": <ushort>, /* Image checksum. */
"ct": <uint>, /* Creation time (Unix timestamp). */
"mt": <uint>, /* Last modification time (Unix timestamp). */
"bu": <long>, /* Assigned unit. */
"pu": <long>, /* Previous assigned unit. */
"bt": <uint>, /* Last assignment/separation time. */
"bs": <long>, /* ID of the sensor that confirms the assignment. */
"pos": { /* Location. */
"y": <double>, /* Latitude. */
"x": <double> /* Longitude. */
}
}
]
If the request for deleting the trailer is completed successfully, the response is returned in the following format:
[
<long>, /* Trailer ID. */
null
]
If the request fails, an error code is returned.
Error codes
| Error code | Description |
|---|---|
| 4 | Wrong input parameters. For the update action type, this error is also returned if the trailer with the specified ID doesn’t exist. |
| 6 | Undefined error. For the delete and reset_image action types, this error is also returned if the trailer with the specified ID doesn’t exist. |
| 7 | The resource doesn’t exist, or the user doesn’t have the Create, edit, and delete trailers access right to it. |