Drivers: create, edit, delete

To create, edit or delete driver, use the command resource/update_driver:

svc=resource/update_driver&params={"itemId":<long>,
				  "id":<long>,
				  "callMode":<text>,
				  "ej":{"apps":[{"appId":<text>,"type":<text>,"uid":<text>,"sn":<text>},...]},
				  "c":<text>,
				  "ck":<short>,
				  "ds":<text>,
				  "n":<text>,
				  "p":<text>,
				  "r":<double>,
				  "f":<uint>,
				  "pwd":<text>,
				  "jp":{
				    	<text>:<text>,
				    	...
				  }}

Parameters

Name Description
itemId resource ID
id driver ID (0 to create)
callMode action: create, update, delete, reset_image
Parameters required only for create and update:
ej extended JSON (with exemple to push notifications)
c code
ck check sum of driver image
ds description
n name
p phone number like +1234567890 (+ must be encoded as %2B)
r aspect ratio of driver image
f flags (4 – exclusive)
pwd password for mobile authorization
jp custom fields in the format “name”:“value”

Response

On create and edit:

[
	<long>,			/* driver ID */
	{
		"id":<long>,		/* driver ID */
		"n":<text>,		/* name */
		"c":<text>,		/* code */
		"ej":<text>,		/* extended JSON */
		"jp": {			/* custom fields */
			<text>:<text>,		/* name: value */
			...
		},
		"pwd":<text>,           /* password for mobile authorization */
		"ds":<text>,		/* description */
		"p":<text>,		/* phone number */
		"r":<double>,		/* aspect ratio of driver image */
		"ck":<ushort>,		/* check sum of driver image */
		"bu":<long>,		/* bound unit */
		"pu":<long>,		/* previous bound unit */
		"bt":<uint>,		/* time of last binding/unbinding */
		"pos":{			/* position */	
			"y":<double>,		/* latitude */	
			"x":<double>		/* longitude */
		}		
	}
]

On delete:

[
	<long>,		/* driver ID */
	null
]