bind_unit_driver
The bind_unit_driver method is used to assign drivers to units or to separate them from units.
svc=resource/bind_unit_driver¶ms={"resourceId":<long>,
"unitId":<long>,
"driverId":<long>,
"time":<uint>,
"mode":<bool>
}
Parameters
| Name | Description |
|---|---|
| resourceId | Resource ID. |
| unitId | Unit ID. |
| driverId | Driver ID. |
| time | Time (0 — current time). |
| mode | Modes:
|
Returned result
If the request is successful, an empty JSON is returned.
{ }
If not, an error code is returned. Possible error codes:
| Code | Description |
|---|---|
| 7 | The resource doesn’t exist or the user doesn’t have the Create, edit, and delete drivers access right to it, or the unit doesn’t exist or the user doesn’t have the View object and its basic properties access right to it. |
| 6 | Failed to assign the driver. |
| 4 | Failed to fetch the driver with the desired driverId or wrong input parameters. |
Request examples
Sent request for assigning a driver:
svc=resource/bind_unit_driver¶ms={"resourceId":930849,"driverId":2,"time":0,"unitId":24675341,"mode":1}
Returned result:
{ }
Sent request for separating a driver:
svc=resource/bind_unit_driver¶ms={"resourceId":930849,"driverId":2,"time":0,"unitId":24675341,"mode":0}
Returned result:
{ }
Assign driver on Feb 07 2022 07:07:00:
svc=resource/bind_unit_driver¶ms={"resourceId":930849, "driverId":17, "time":1644217620, "unitId":22361100, "mode":1}
Returned result:
{ }
Separate driver on Feb 07 2022 09:08:00:
svc=resource/bind_unit_driver¶ms={"resourceId":930849,"driverId":17,"time":1644224880,"unitId":22361100,"mode":0}
Returned result:
{ }
You also can merge these two requests into one using core/batch:
svc=core/batch¶ms={"params":[{"svc":"resource/bind_unit_driver","params":{"resourceId":930849,"driverId":17,"time":1644217620,"unitId":22361100,"mode":true}},{"svc":"resource/bind_unit_driver","params":{"resourceId":930849,"driverId":17,"time":1644224880,"unitId":22361100,"mode":false}}],"flags":0}
For the returned result, see the response section for the batch method.