Query All Geofences

Last Updated on : 2023-06-20 14:52:24download

Query geofences for a account by page according to the geofence attribute conditions.

API address

GET: /v2.0/iot-01/fences/list

Request parameter

Parameter name Type IN Required Description
bind_type Integer query false Indicates the binding type of the geofence. Valid values:
  • 1: private geofence.
  • 2: public geofence.
entity_id String query false The entity ID.
page_index Integer query false The page index. Default value: 1.
page_size Integer query false The number of items returned on each page. Default value: 50.
last_row_key Long query false The last row key. Choose page_index or last_id.
last_id: Query only the next page at a high speed. The value is not returned if the first page is queried.
page_index: Query the specified page.
tag String query false The custom dimension tag to classify the geofences. The geofences can be filtered by the dimension tags.
coord_type_output String query false Indicates the type of the longitude and latitude positioning coordinate system. Valid values:
  • WGS84: Google Coordinate System.
  • GCJ02: AutoNavi.
  • BD09LL: Baidu.
  • Empty value: Defaults to AutoNavi for China data center, and Google for other data centers.

Return parameter

Parameter name Type Description
result PageRes

Description of result

Parameter name Type Description
data List The list of entries on the current page.
total Long The total number of items.
last_row_key Long The row key of the last item on the current page.
last_page Boolean Indicates whether it is the last page. Valid values: true: yes. false: no.

Description of data

Parameter name Type Description
fence_id Long The geofence ID.
fence_name String The name of the geofence.
bind_type Integer Indicates the binding type of the geofence. Valid values:
  • 1: private geofence.
  • 2: public geofence.
entity_id String The ID of a monitored object.
shape String Indicates the shape of the geofence. Valid values:
  • circle: The geofence is circular.
  • polygon: The geofence is polygonal.
fence_data FenceShapeDataRes The data points (DPs) of a geofence.
warn_rule Integer Indicates the alert rules. Valid values:
  • 1: triggers an alert when someone enters the geofence.
  • 2: triggers an alert when someone exits the geofence.
  • 3: triggers an alert when someone enters or exits the geofence.
enable Integer Indicates whether the geofence is enabled. Valid values:
  • 0: disabled.
  • 1: enabled.

Description of fence_data

Parameter name Type Description
circle CircleDataRes The data of a circular geofence.
polygon List The data of a polygonal geofence.

Description of polygon

Parameter name Type Description
lon Double The longitude of a polygonal point.
lat Double The latitude of a polygonal point.

Description of circle

Parameter name Type Description
radius Integer The radius of a geofence. Unit: meters.
lon Double The longitude of a geofence center point.
lat Double The latitude of a geofence center point.

Request example

GET: /v2.0/iot-01/fences/list?bind_type=1&entity_id&page_index=210&page_size=1&last_row_key

Return example

{ "result": { "last_row_key": 50004, "data": [ { "shape": "circle", "fence_data": { "circle": { "lon": 31.218093093844796, "radius": 200, "lat": 121.36040929664462 } }, "entity_id": "vdevo16245017293****", "bind_type": 1, "fence_id": 50004, "fence_name": "The First Private Geofence", "enable": 1, "warn_rule": 1 } ], "last_page": false, "total": 213 }, "t": 1625217837075, "success": true }

Error code

For more information, see error code.