bind_unit_driver

The bind_unit_driver method is used to assign drivers to units or to separate them from units.

Copied!
svc=resource/bind_unit_driver&params={"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:
  • 1/true — assign;
  • 0/false — separate.

Returned result

If the request is successful, an empty JSON is returned.

Copied!
{ }

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:

Copied!
svc=resource/bind_unit_driver&params={"resourceId":930849,"driverId":2,"time":0,"unitId":24675341,"mode":1}

Returned result:

Copied!
{ }

Sent request for separating a driver:

Copied!
svc=resource/bind_unit_driver&params={"resourceId":930849,"driverId":2,"time":0,"unitId":24675341,"mode":0}

Returned result:

Copied!
{ }

Assign driver on Feb 07 2022 07:07:00:

Copied!
svc=resource/bind_unit_driver&params={"resourceId":930849, "driverId":17, "time":1644217620, "unitId":22361100, "mode":1}

Returned result:

Copied!
{ }

Separate driver on Feb 07 2022 09:08:00:

Copied!
svc=resource/bind_unit_driver&params={"resourceId":930849,"driverId":17,"time":1644224880,"unitId":22361100,"mode":0}

Returned result:

Copied!
{ }

You also can merge these two requests into one using core/batch:

Copied!
svc=core/batch&params={"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.

If you find a mistake in the text, please select it and press Ctrl+Enter.