Geofences: create, edit, delete

To create, edit or delete geofences, use the command resource/update_zone:

svc=resource/update_zone&params={"itemId":<long>,
				 "id":<long>,
				 "callMode":<text>,
				 "n":<text>,
				 "d":<text>,
				 "t":<int>,
				 "w":<int>,
				 "f":<uint>,
				 "c":<int>,
				 "p":[				
					{
						"x":<double>,
						"y":<double>,
						"r":<int>
					}
				 ]}

Parameters

Name Description
itemId resource ID
id geofence ID
callMode action: create, update, delete

Other parameters are required only for creating and updating, you can see them in the chapter Geofences: detailed information.

Response

On create and edit:

[
	<long>,		/* geofence ID */
	{
		"n":<text>,	/* name */
		"d":<text>,	/* description */
		"id":<long>,	/* geofence ID */
		"f":<uint>,	/* flags */
		"t":<int>,	/* type: 1 - line, 2 - polygon, 3 - circle */
		"e":<ushort>	/* check sum (CRC16) */
		"b":{		/* configuration for rendering */
			"min_x":<double>,	/* minimal longitude */
			"min_y":<double>,	/* minimal latitude */
			"max_x":<double>,	/* maximal longitude */
			"max_y":<double>,	/* maximal latitude */
			"cen_x":<double>,	/* longitude of center */
			"cen_y":<double>	/* latitude of center */
		},
		"ct":<uint>,    /* creation time */  
		"mt":<uint>     /* last modification time */
	}
]

Geofences flags are described in the chapter Geofences: detailed information.

On delete:

[
	<long>,		/* geofence ID */
	null
]
Follow us on Facebook Gurtam Wialon Twitter Gurtam Wialon info@gurtam.com   |   Copyright © 2002-2020 Gurtam