To operate drivers, use command resource/driver_operate:
To authorization you can use pairs of:
"phoneNumber":<text>, /* driver phone number */ "password":<text> /* driver password */
or
"phoneNumber":<text>, /* unit phone number */ "password":<text> /* unit password */
For “callMode“:”say“,”read” you can use “sid“.
Driver must be binded to unit.
Status of unit with binded driver
svc=resource/driver_operate¶ms={"phoneNumber":<text>, "password":<text>, "callMode":"status", "app":<text>,/* application name for the generated token */ "fl":<uint> /* optional flags (1 - return token, 2 - return status even if driver is not binded ) */ }
Response
{"un":{ /* unit parameters */ "nm":<text>, "cls":<uint>, "id":<uint>, "mu":<uint>, "pos":{ ... }, "lmsg":{ ... }, "uri":<text>, "ugi":<uint>, "uacl":<int> }, "drv":{ /* driver parameters */ "nm":<text>}, "uh":<text>, /* encrypted device information (for WiaTag) */ "ul":<text>, /* encrypted phone number (for WiaTag) */ "h":<text> /* token */ }
Parameters description and entry of “pos“, “lmsg” you can find here: Units
Send message to driver
You can send files with multipart/form-data
Without “sid”
svc=resource/driver_operate¶ms={"phoneNumber":<text>, "password":<text>, "callMode":"say", "message":<text>, "timeSend":<uint>, "ej":<JSON> /* extend JSON */, "appId":<text>, /* application Id for push notification */ "appType":<text> /* application type for push notification */ }
With “sid”
svc=resource/driver_operate¶ms={"resourceId":<uint>, "driverId":<uint>, "callMode":"say", "message":<text>, "timeSend":<uint>, "ej":<JSON> /* extend JSON */, "appId":<text>, /* application Id for push notification */ "appType":<text> /* application type for push notification */ }
Response
{ "tm":<uint> /* time of message */ }
Read messages from driver
Without “sid”
svc=resource/driver_operate¶ms={"phoneNumber":<text>, "password":<text>, "callMode":"read", "timeFrom":<uint>, "timeTo":<uint> }
With “sid”
svc=resource/driver_operate¶ms={"resourceId":<uint>, "driverId":<uint>, "callMode":"read", "timeFrom":<uint>, "timeTo":<uint> }
Response
[ { "t": <time>, "f": <uint>, "tp": <text>, "p": { "flags": <uint>, "text":<text>, "time_send":<uint>, "ej":"<JSON>", "files": { <text>: <uint> /* filename: file ID */ } } }, ... ]
Parameters description you can find here: Messages
Get order list
svc=resource/driver_operate¶ms={"phoneNumber":<text>, "password":<text>, "callMode":"orders_list", }
Response
[ { "id":<uint>, "n":<text>, "f":<uint>, "tf":<uint>, "tt":<uint>, "trt":<uint>, "uid":<uint>, "r":<uint>, "y":<double>, "x":<double>, "u":<long>, "s":<uint>, "sf":<uint>, "st":<uint>, "cnm":<uint>, "p": { "ut":<uint>, ... } }, ... ]
Parameters description you can find here: Update order
Reject order
You can send files with multipart/form-data
svc=resource/driver_operate={"phoneNumber":<text>, "password":<text>, "callMode":"order_reject", "id":<uint> }
Response
{ error: 0, /* if success */ }
Confirm order
You can send files with multipart/form-data
svc=resource/driver_operate={"phoneNumber":<text>, "password":<text>, "callMode":"order_confirm", "id":<uint> }
Response
{ error: 0, /* if success */ }
Mark message from driver
svc=resource/driver_operate={"phoneNumber":<text>, "password":<text>, "callMode":"mark_message", "message":<text>, "time":<uint>, "flags":<uint> }
Response
{ error: 0, /* if success */ }
Get photo from driver message
svc=resource/driver_operate={"phoneNumber":<text>, "password":<text>, "callMode":"get_message_file", "fileId":<text> }
fileId you can get using callMode:read
Response
Returns an image.
Get list of order attachments
svc=resource/driver_operate={"phoneNumber":<text>, "password":<text>, "callMode":"order_attachments", "id":<text> /* order ID */ }
Response
[ { "n":<text>, /* file name */ "s":<uint>, /* file size */ "ct":<uint>, /* file creation time */ "mt":<uint> /* file modification time */ } ]
Get order attachment
svc=resource/driver_operate={"phoneNumber":<text>, "password":<text>, "callMode":"order_get_attachment", "id":<text>, /* order ID */ "path":<text> /* attachment file name */ }
Response
Returns an attachment file.