update_schedule
To create, edit or delete schedules, use the route/update_schedule method:
svc=route/update_schedule
params={
"itemId": <long>,
"id": <long>,
"callMode": <text>,
"n": <text>,
"f": <uint>,
"tz": <uint>,
"u": <long>,
"tm": [
{
"at": <uint>,
"ad": <uint>,
"dt": <uint>,
"dd": <uint>
}
],
"sch": {
"f1": <uint>,
"f2": <uint>,
"t1": <uint>,
"t2": <uint>,
"m": <uint>,
"y": <uint>,
"w": <uint>
},
"cfg": {
"name": <text>,
"units": [<long>],
"enabled": <byte>,
"roundFlags": <uint>,
"autoName": <byte>,
"validityPeriod": <uint>
}
}
Parameters
The request must contain the following parameters:
Parameter | Description |
---|---|
itemID | Route ID. |
id | Schedule ID. |
callMode | Action: create , update , delete . |
The other parameters are required only for creating and editing. For their description, see get_round_data.
The values of the f1
, t1
, f2
, t2
parameters must be lower or equal to 0xFFFF.
Response
If the request is completed successfully, the response format depends on the action specified in the callMode
parameter.
The response to the request for creating or updating a schedule is returned in the following format:
[
<long>, // Schedule ID
{
"id": <long>, // Schedule ID.
"n": <text>, // Name.
"f": <uint>, // Schedule type (see below).
"tz": <uint>, // Timezone.
"cfg": { // Custom configuration (example).
"autoName": <byte>, // Use an automatically generated name: 1 = yes, 0 = no.
"enabled": <byte>, // Create rides automatically: 1 = yes, 0 = no.
"name": <text>, // Ride name.
"description":<text>, // Description.
"roundFlags": <uint>, // Ride flags.
"units": [<long>], // Array of unit IDs.
"validityPeriod": <uint> // Validity period.
},
"tm": [ // Time of passing the checkpoints.
{
"at": <uint>, // Arrival time.
"ad": <uint>, // Deviation from the arrival time.
"dt": <uint>, // Departure time
"dd": <uint> // Deviation from the departure time.
}
],
"sch": { // Time limitations.
"f1": <uint>, // Start of interval 1.
"f2": <uint>, // Start of interval 2.
"t1": <uint>, // End of interval 1.
"t2": <uint>, // End of interval 2.
"m": <uint>, // Day-of-month mask
"y": <uint>, // Month mask
"w": <uint> // Day-of-week mask
}
}
]
Schedule types
Flag | Description |
---|---|
0x1 | Relative to activation. |
0x2 | Relative to day. |
0x4 | Absolute. |
The response to the request for deleting a schedule is returned in the following format:
[
<long>, // Schedule ID.
null
]
If the request fails, an error code is returned.
Error codes
Error Code | Description |
---|---|
4 | Invalid input parameters (including invalid callMode , missing required parameters, or invalid schedule times). |
6 | Failed to find the created schedule, or failed to update or delete the schedule. |
7 | Internal error or missing ADF_ACL_AVL_ROUTE_EDIT_SETTINGS access right to the route. |