Moving Geofence API

post
Create Moving-Geofence API

https://api.geospark.co/v3/api/moving-geofence/
The create Moving Geofence API is responsible for creating moving-geofences for projects.
Request
Response
Request
Headers
Api-key
required
string
Auth-key E.g.- 332223kfhdjahsiebjsb5s
Body Parameters
users
required
array
Array of user_ids to create moving-geofences. E.g.- ["5f520949e3872b0341bcf3e7", "5f520955e3872b0341bcf3e8", "5f083247b3611453c98a726f"]
metadata
optional
array
An optional set of custom key-value pairs for the geofence.
geometry_type
required
string
Defines the type of geometry. E.g.- circle
geometry_radius
required
integer
Defines the radius of circular geofence in meters. Range 50m to 1000m. (Required only for geometry_type circle. Field value ignored if sent when geometry_type is a polygon.) E.g.- 50m to 1000m max
color_code
optional
string
Defines the color of Geofence and how it is displayed on the dashboard. Type: Hex Code for CSS colors. Note: Pass the code without '#'. E.g.- ffffff
tag
optional
string
Tag the GeoFences for future reference and filtering. E.g.- hotel
description
optional
string
Optional description for the geofence. E.g.- This is just a 5 star cool hotel where you can stay.
is_enabled
optional
boolean
Enable/Disable 'event_trigger' for Geofences. By default event trigger are disabled. E.g.- true or false
Response
200: OK
{
"status": true,
"msg": "Geofence Added successfully.",
"code": 201,
"data": {
"id": "5f9801aeffb3fb0de55e863d",
"account_id": "5bda16a2ea00845b3b419160",
"project_id": "5bda16edea00845b3b419163",
"geometry_type": "circle",
"geometry_radius": 500,
"is_enabled": true,
"is_deleted": false,
"created_at": "2020-10-27T11:17:02.956",
"updated_at": "2020-10-27T11:17:02.959",
"only_once": true,
"users": [
"5f520949e3872b0341bcf3e7",
"5f520955e3872b0341bcf3e8"
]
}
}

Sample Request

curl --location --request POST 'https://api.geospark.co/v3/api/moving-geofence/' \
--header 'Api-Key: e566c098cc6b441a9c3453b6fcf76e88' \
--header 'Content-Type: application/json' \
--data-raw '{
"geometry_type": "circle",
"geometry_radius": 500,
"is_enabled": true,
"only_once": true,
"users": ["5f520949e3872b0341bcf3e7","5f520955e3872b0341bcf3e8","5f083247b3611453c98a726f"]
}'

put
Update Moving-Geofence API

https://api.geospark.co/v3/api/moving-geofence/
Use this API to update details for an existing moving-geofence of any specific project using Update Geofence API.
Request
Response
Request
Headers
Api-key
required
string
Auth-key E.g.- 33223kjhdcscijhb5sdbsdmjsdcbj5f
Body Parameters
geofence_id
required
string
geofence_id which need to be updated. E.g.- 5bd2aee1eec1a50d8faf1293
metadata
optional
array
An optional set of custom key-value pairs for the geofence.
color_code
optional
string
Defines the color of Geofence and how it is displayed on the dashboard. Type: Hex Code for CSS colors. Note: Pass the code without '#'. E.g.- ffffff
tag
optional
string
Tag the GeoFences for future reference and filtering. E.g.- hotel
description
optional
string
Optional description for the geofence. E.g.- This is just a 5 star cool hotel where you can stay.
is_enabled
optional
boolean
Enable/Disable 'event_trigger' for Geofences. By default event trigger are disabled. E.g.- true or false
Response
200: OK
{
"status": true,
"msg": "Geofence updated successfully.",
"code": 200,
"data": {
"id": "5f9801aeffb3fb0de55e863d",
"account_id": "5bda16a2ea00845b3b419160",
"project_id": "5bda16edea00845b3b419163",
"geometry_type": "circle",
"geometry_radius": 500,
"is_enabled": true,
"description": "testing geofence",
"color_code": "ggggg",
"tag": "border code",
"is_deleted": false,
"created_at": "2020-10-27T11:17:02.956",
"updated_at": "2020-10-27T11:20:33.050",
"only_once": true,
"users": [
"5f520949e3872b0341bcf3e7",
"5f520955e3872b0341bcf3e8"
]
}
}

Sample Request

curl --location --request PUT 'https://api.geospark.co/v3/api/moving-geofence/' \
--header 'Api-Key: e566c098cc6b441a9c3453b6fcf76e88' \
--header 'Content-Type: application/json' \
--data-raw '{
"geofence_id": "5f9801aeffb3fb0de55e863d",
"is_enabled": true,
"description": "testing geofence",
"tag": "border code",
"color_code": "ggggg"
}'

get
GET Moving-Geofence API

https://api.geospark.co/v3/api/moving-geofence/
This API gives you the filtered list of moving-geofences.
Request
Response
Request
Headers
Api-key
required
string
Auth-key E.g.- 33223kjhdcscijhb5sdbsdmjsdcbj5f
Query Parameters
start_date
required
string
Date from when the geofences created to be fetched. E.g.- 2020-09-28
end_date
required
string
Date till when the data need to be returned. E.g.- 2020-09-29
geofence_id
optional
string
Get the details of one geofence. E.g.- 5f73326ce5fc231ba4b253eb
page_number
optional
integer
This field can be used for getting 10 entries at a time. If the response returns an empty list in data field, it is safe to assume the pages are exhausted. E.g.- 1
Response
200: OK
{
"status": true,
"msg": "Success.",
"code": 200,
"data": {
"next_page": null,
"pages": 1,
"prev_page": null,
"account_id": "5bda16a2ea00845b3b419160",
"project_id": "5bda16edea00845b3b419163",
"users": [
"5f520949e3872b0341bcf3e7",
"5f520955e3872b0341bcf3e8"
],
"geofences": [
{
"counts": {
"events": 0,
"users": 0
},
"id": "5f9801aeffb3fb0de55e863d",
"geometry_type": "circle",
"geometry_radius": 500,
"is_enabled": true,
"description": "testing geofence",
"color_code": "ggggg",
"tag": "border code",
"is_deleted": false,
"created_at": "2020-10-27T11:17:02.956",
"updated_at": "2020-10-27T11:20:33.050",
"only_once": true
}
]
}
}

Sample Request

curl --location --request GET 'https://api.geospark.co/v3/api/moving-geofence/?start_date=2020-10-27&end_date=2020-10-27&count=True' \
--header 'Api-Key: e566c098cc6b441a9c3453b6fcf76e88'

delete
Delete Moving-Geofence API

https://api.geospark.co/v3/api/moving-geofence/
Delete Geofence API allows you to delete already existing moving-geofences for a project.
Request
Response
Request
Headers
Api-key
required
string
Auth-key E.g.- 33223kjhdcscijhb5sdbsdmjsdcbj5f
Query Parameters
geofence_id
required
string
Delete geofence for this id. E.g.- 5f9801aeffb3fb0de55e863d
Response
200: OK
{
"status": true,
"msg": "Geofence deleted successfully.",
"code": 200,
"data": {}
}

Sample Request

curl --location --request DELETE 'https://api.geospark.co/v3/api/moving-geofence/?geofence_id=5f9801aeffb3fb0de55e863d' \
--header 'Api-Key: e566c098cc6b441a9c3453b6fcf76e88' \
--header 'Content-Type: application/json'