Events API

get
Get Events API

https://api.geospark.co/v3/api/event/
The Get Events API lets you fetch the entry or exit events of the users from your event enabled geofences. The API also lets you filter by user or geofence, location, and more.
Request
Response
Request
Headers
Api-key
required
string
Auth-key E.g.- 33223kjhdcscijhb5sdbsdmjsdcbj5f
Query Parameters
user_id
optional
string
Filters events data for the given user_id. E.g.- 5d9450ace47bae6d70064a9b
geofence_id
optional
string
Filters events data for the given geofence_id. E.g.- 5eecc7491e621663c93ba2fe
start_date
required
string
Filters events data for the given data range. E.g.- 2020-08-05
end_date
required
string
Filters events data for the given date range. E.g.- 2020-08-09
page_number
optional
integer
This field can be used for getting 10 entries at a time. if the response returns an empty list in the data field, it is safe to assume the pages are exhausted. If points_encoded value is true, then this value will not be considered. E.g.- 1
Response
200: OK
{
"status": true,
"msg": "Success.",
"code": 200,
"data": {
"next_page": 2,
"pages": 3,
"prev_page": null,
"account_id": "5c0179df6f994031158a5646",
"events": [
{
"id": "5f2c03c40401996e6d6c8ad4",
"user_description": "postman device test",
"user_id": "5f2be41bb3611421f252e3c3",
"geofence_description": "365",
"geofence_id": "5eecc7491e621663c93ba2fe",
"location_id": "5f2be4ede3872b4e6519f8f2",
"event_type": "motion:geofence:entry",
"recorded_at": "2020-08-06T11:09:33.280",
"created_at": "2020-08-06T13:21:08.283",
"is_deleted": false
},
{
"id": "5f2be6634fac5ac31f740a09",
"user_description": "postman device test",
"user_id": "5f2be3c5b3611421f152e0dc",
"geofence_description": "365",
"geofence_id": "5eecc7491e621663c93ba2fe",
"location_id": "5f2be662e3872b4f0d138e13",
"event_type": "motion:geofence:entry",
"recorded_at": "2020-08-06T11:15:46.107",
"created_at": "2020-08-06T11:15:47.285",
"is_deleted": false
},
{
"id": "5f2be5ab972cb25c216b8bc8",
"user_description": "postman device test",
"user_id": "5f2be41bb3611421f252e3c3",
"geofence_description": "365",
"geofence_id": "5eecc7491e621663c93ba2fe",
"location_id": "5f2be4ede3872b4e6519f8f2",
"event_type": "motion:geofence:entry",
"recorded_at": "2020-08-06T11:09:33.280",
"created_at": "2020-08-06T11:12:43.542",
"is_deleted": false
},
{
"id": "5f2be4ef4fac5ac31f740a08",
"user_description": "postman device test",
"user_id": "5f2be41bb3611421f252e3c3",
"geofence_description": "365",
"geofence_id": "5eecc7491e621663c93ba2fe",
"location_id": "5f2be4ede3872b4e6519f8f2",
"event_type": "motion:geofence:entry",
"recorded_at": "2020-08-06T11:09:33.280",
"created_at": "2020-08-06T11:09:35.655",
"is_deleted": false
},
{
"id": "5f2be028ad018ed53929605a",
"user_description": "postman device test",
"user_id": "5f2bd1e9b3611421f252e36c",
"geofence_description": "365",
"geofence_id": "5eecc7491e621663c93ba2fe",
"location_id": "5f2be027e3872b4b97b61f6d",
"event_type": "motion:geofence:entry",
"recorded_at": "2020-08-06T10:49:11.381",
"created_at": "2020-08-06T10:49:12.636",
"is_deleted": false
},
{
"id": "5f2bdd15cb6a6dd83389d2fe",
"user_description": "postman device test",
"user_id": "5f2bd4cfb3611421f252e378",
"geofence_description": "365",
"geofence_id": "5eecc7491e621663c93ba2fe",
"location_id": "5f2bdd12e3872b49dc215b1f",
"event_type": "motion:geofence:entry",
"recorded_at": "2020-08-06T10:36:02.951",
"created_at": "2020-08-06T10:36:05.404",
"is_deleted": false
},
{
"id": "5f2bd913b371fa62bad8fda5",
"user_description": "postman device test",
"user_id": "5f2bd1e9b3611421f252e36c",
"geofence_description": "365",
"geofence_id": "5eecc7491e621663c93ba2fe",
"location_id": "5f2bd90fe3872b46fe340362",
"event_type": "motion:geofence:exit",
"recorded_at": "2020-08-06T10:18:55.914",
"created_at": "2020-08-06T10:18:59.112",
"is_deleted": false
},
{
"id": "5f2bd565b371fa62bad8fda2",
"user_description": "postman device test",
"user_id": "5f2bd1e9b3611421f252e36c",
"geofence_description": "365",
"geofence_id": "5eecc7491e621663c93ba2fe",
"location_id": "5f2bd562e3872b43e156a54a",
"event_type": "motion:geofence:entry",
"recorded_at": "2020-08-06T10:03:14.617",
"created_at": "2020-08-06T10:03:17.245",
"is_deleted": false
},
{
"id": "5efc696e8cb244000185ea2d",
"user_description": "location test device",
"user_id": "5efc67c6a40ad3095d17be18",
"geofence_description": "365",
"geofence_id": "5eecc7491e621663c93ba2fe",
"location_id": "5efc696ca40ad3095d17be79",
"app_id": "5e95cbe83722794cf72ea0af_1",
"event_type": "exit",
"coordinates": {
"type": "Point",
"coordinates": [
80.08113,
12.91806
]
},
"recorded_at": "2020-07-01T10:46:03.000",
"timezone_offset": "+0530",
"created_at": "2020-07-01T10:46:06.459",
"is_deleted": false
},
{
"id": "5efc696a8cb244000185ea29",
"user_description": "location test device",
"user_id": "5efc67c6a40ad3095d17be18",
"geofence_description": "365",
"geofence_id": "5eecc7491e621663c93ba2fe",
"location_id": "5efc6968a40ad3096417bb5f",
"app_id": "5e95cbe83722794cf72ea0af_1",
"event_type": "entry",
"coordinates": {
"type": "Point",
"coordinates": [
80.08572,
12.91959
]
},
"recorded_at": "2020-07-01T10:46:00.000",
"timezone_offset": "+0530",
"created_at": "2020-07-01T10:46:02.379",
"is_deleted": false
}
]
}
}

Sample Request

curl --location --request GET 'https://api.geospark.co/v3/api/event/?geofence_id=5eecc7491e621663c93ba2fe&start_date=2020-08-05&end_date=2020-08-09&page_number=1&user_id=5f2bd1e9b3611421f252e36c&project_id=5e95cbe83722794cf72ea0af' \
--header 'Api-Key: 50ccfe35a1ee409f9791cdee340e5864'

get
GET Trip Events

https://api.geospark.co/v3/api/event/trips/
The Get Trip Events API lets you fetch the events of the users triggered during a trip.
Request
Response
Request
Headers
Api-key
required
string
Auth-key E.g.- 33223kjhdcscijhb5sdbsdmjsdcbj5f
Query Parameters
page_number
optional
integer
Used to go through all the pages of data. E.g.- 1
user_id
required
string
Filters events data for the given user_id. E.g.- 5d9450ace47bae6d70064a9b
trip_id
optional
string
Filters events data for the given trip_id. E.g.- 5cd024aa9533a30eb6147132
start_date
required
string
Date to define the start of date_range of data to be returned. E.g.- 2020-09-01
end_date
required
string
Date to define the end of date_range. E.g.- 2020-10-02
Response
200: OK
{
"status": true,
"msg": "Success.",
"code": 200,
"data": {
"next_page": 2,
"pages": 2,
"prev_page": null,
"events": [
{
"trip_id": "5f7dac74ffb3fb58435309e7",
"event_source": "geospark:trip",
"event_version": "1.0",
"event_type": "geospark:trip:ended",
"created_at": "2020-10-07T11:54:47.547000",
"user_id": "5f7daae0e5fc233612297d5a",
"id": "5f7dac87bd4165ae1751b49d"
},
{
"trip_id": "5f7dac74ffb3fb58435309e7",
"event_source": "geospark:trip",
"event_version": "1.0",
"event_type": "geospark:trip:started",
"created_at": "2020-10-07T11:54:36.747000",
"user_id": "5f7daae0e5fc233612297d5a",
"id": "5f7dac7cbd4165ae1751b49c"
},
{
"trip_id": "5f7dac74ffb3fb58435309e7",
"event_source": "geospark:trip",
"event_version": "1.0",
"event_type": "geospark:trip:created",
"created_at": "2020-10-07T11:54:31.620000",
"user_id": "5f7daae0e5fc233612297d5a",
"id": "5f7dac77bd4165ae1751b49b"
},
{
"trip_id": "5f7dac3de5fc233612297d5d",
"event_source": "geospark:trip",
"event_version": "1.0",
"event_type": "geospark:trip:created",
"created_at": "2020-10-07T11:53:35.464000",
"user_id": "5f7daae0e5fc233612297d5a",
"id": "5f7dac3fbd4165ae1751b49a"
},
{
"trip_id": "5f7dac37ffb3fb583d5309e2",
"event_source": "geospark:trip",
"event_version": "1.0",
"event_type": "geospark:trip:ended",
"created_at": "2020-10-07T11:53:33.149000",
"user_id": "5f7daae0e5fc233612297d5a",
"id": "5f7dac3dbd4165ae1751b499"
},
{
"trip_id": "5f7dac37ffb3fb583d5309e2",
"event_source": "geospark:trip",
"event_version": "1.0",
"event_type": "geospark:trip:started",
"created_at": "2020-10-07T11:53:31.780000",
"user_id": "5f7daae0e5fc233612297d5a",
"id": "5f7dac3bbd4165ae1751b498"
},
{
"trip_id": "5f7dac37ffb3fb583d5309e2",
"event_source": "geospark:trip",
"event_version": "1.0",
"event_type": "geospark:trip:created",
"created_at": "2020-10-07T11:53:29.718000",
"user_id": "5f7daae0e5fc233612297d5a",
"id": "5f7dac39bd4165ae1751b497"
},
{
"trip_id": "5f7dab4ee5fc233611297c78",
"event_source": "geospark:trip",
"event_version": "1.0",
"event_type": "geospark:trip:ended",
"created_at": "2020-10-07T11:50:21.457000",
"user_id": "5f7daae0e5fc233612297d5a",
"id": "5f7dab7dbd4165ae1751b496"
},
{
"trip_id": "5f7dab4ee5fc233611297c78",
"event_source": "geospark:trip",
"event_version": "1.0",
"event_type": "geospark:trip:reached_origin",
"location": {
"type": "Point",
"coordinates": [
77.622977,
12.918705611879671
]
},
"created_at": "2020-10-07T11:50:19.279000",
"speed": 0,
"course": 0,
"altitude": 505.20001220703125,
"activity": "S",
"horizontal_accuracy": 20,
"user_id": "5f7daae0e5fc233612297d5a",
"location_id": "5f2ba9edb3611421f252e019",
"trip_location_id": "5f7dab4ee5fc233611297c79",
"recorded_at": "2020-10-07T11:50:16.158000",
"id": "5f7dab7bbd4165ae1751b495"
},
{
"trip_id": "5f7dab4ee5fc233611297c78",
"event_source": "geospark:trip",
"event_version": "1.0",
"event_type": "geospark:trip:started",
"created_at": "2020-10-07T11:50:12.378000",
"user_id": "5f7daae0e5fc233612297d5a",
"id": "5f7dab7447cd80500a7f7e49"
}
]
}
}

Sample Request

curl --location --request GET 'https://api.geospark.co/v3/api/event/trips/?trip_id=5f71ad9a5c3a0f059acebb39' \
--header 'Api-Key: 50ccfe35a1ee409f9791cdee340e5864'