Trips

The Get Trips API lets you fetch the trips data of all active ongoing and completed trips for your users.

get
Get Trips List API

https://api.geospark.co/v1/api/trips/
The Get Trips list API lets you fetch the list of all trips data of all active ongoing and completed trips for your users.
Request
Response
Headers
Api-Key
required
string
33223kjhdcscijhb5sdbsdmjsdcbj5f
Content-Type
required
string
application/json
Query Parameters
user_id
optional
string
Filters the trips data for the given user_id.
start_date
optional
string
This field can be used for defining a start date from which the list of users need to be shown. Input Data: 2018-10-19
end_date
optional
string
This field can be used to define a range of time till when the last document needs to be provided. 'end_date' should always be greater than 'start_date'. If end_date is provided then start_date should also be provided.If only start_date is passed, the user list for same day will be returned. Input Date: 2018-10-20
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 filed, it is safe to assume the pages are exhausted.
200: OK
JSON
{
"status": true,
"msg": "Success.",
"code": 200,
"data": {
"next_page": null,
"pages": 1,
"prev_page": null,
"trips": [
{
"id": "5d946bc45f37c6157d371d8f",
"project_id": "5d930b99670dc8057b7b0eb3",
"origins": [
{
"id": "5d946bc45f37c6157d371d90",
"trip_id": "5d946bc45f37c6157d371d8f",
"created_at": "2019-10-02T09:20:04.232",
"updated_at": "2019-10-02T09:20:11.730",
"coordinates": {
"type": "Point",
"coordinates": [
77.622977,
12.917042
]
},
"reached": true,
"left": true,
"loc_type": "origin"
},
{
"id": "5d946bc45f37c6157d371d91",
"trip_id": "5d946bc45f37c6157d371d8f",
"created_at": "2019-10-02T09:20:04.245",
"updated_at": "2019-10-02T09:20:16.638",
"coordinates": {
"type": "Point",
"coordinates": [
77.650239,
12.924304
]
},
"reached": true,
"left": true,
"loc_type": "origin"
},
{
"id": "5d946bc45f37c6157d371d92",
"trip_id": "5d946bc45f37c6157d371d8f",
"created_at": "2019-10-02T09:20:04.257",
"updated_at": "2019-10-02T09:20:16.710",
"coordinates": {
"type": "Point",
"coordinates": [
77.743206,
12.954302
]
},
"reached": true,
"loc_type": "origin"
}
],
"destinations": [
{
"id": "5d946bc45f37c6157d371d93",
"trip_id": "5d946bc45f37c6157d371d8f",
"created_at": "2019-10-02T09:20:04.269",
"updated_at": "2019-10-02T09:20:04.274",
"coordinates": {
"type": "Point",
"coordinates": [
78.743206,
12.954302
]
},
"reached": false,
"loc_type": "destination"
}
],
"events": [
{
"id": "5d946bc45f37c6157d371d94",
"trip_id": "5d946bc45f37c6157d371d8f",
"user_id": "5d946b665f37c6158337199e",
"event_type": "trip:created",
"created_at": "2019-10-02T09:20:04.287",
"is_deleted": false
},
{
"id": "5d946bc6670dc8057b7b1094",
"trip_id": "5d946bc45f37c6157d371d8f",
"user_id": "5d946b665f37c6158337199e",
"event_type": "trip:user_reached_origin",
"trip_location_id": "5d946bc45f37c6157d371d90",
"user_location_id": "5d946bc6670dc8057b7b1092",
"created_at": "2019-10-02T09:20:06.707",
"is_deleted": false
},
{
"id": "5d946bc95f37c615833719a1",
"trip_id": "5d946bc45f37c6157d371d8f",
"user_id": "5d946b665f37c6158337199e",
"event_type": "trip:started",
"user_location_id": "5d946bc95f37c6158337199f",
"created_at": "2019-10-02T09:20:09.523",
"is_deleted": false
},
{
"id": "5d946bcb670dc805807b0b99",
"trip_id": "5d946bc45f37c6157d371d8f",
"user_id": "5d946b665f37c6158337199e",
"event_type": "trip:user_left_origin",
"trip_location_id": "5d946bc45f37c6157d371d90",
"user_location_id": "5d946bcb670dc805807b0b97",
"created_at": "2019-10-02T09:20:11.735",
"is_deleted": false
},
{
"id": "5d946bce5f37c6157d371d97",
"trip_id": "5d946bc45f37c6157d371d8f",
"user_id": "5d946b665f37c6158337199e",
"event_type": "trip:user_reached_origin",
"trip_location_id": "5d946bc45f37c6157d371d91",
"user_location_id": "5d946bce5f37c6157d371d95",
"created_at": "2019-10-02T09:20:14.099",
"is_deleted": false
},
{
"id": "5d946bd0670dc8057b7b1097",
"trip_id": "5d946bc45f37c6157d371d8f",
"user_id": "5d946b665f37c6158337199e",
"event_type": "trip:user_left_origin",
"trip_location_id": "5d946bc45f37c6157d371d91",
"user_location_id": "5d946bd0670dc8057b7b1095",
"created_at": "2019-10-02T09:20:16.643",
"is_deleted": false
},
{
"id": "5d946bd0670dc8057b7b1098",
"trip_id": "5d946bc45f37c6157d371d8f",
"user_id": "5d946b665f37c6158337199e",
"event_type": "trip:user_reached_origin",
"trip_location_id": "5d946bc45f37c6157d371d92",
"user_location_id": "5d946bd0670dc8057b7b1095",
"created_at": "2019-10-02T09:20:16.710",
"is_deleted": false
}
],
"user_id": "5d946b665f37c6158337199e",
"is_started": true,
"is_ended": false,
"is_deleted": false,
"trip_started_at": "2019-10-02T09:20:09.229",
"is_paused": false,
"created_at": "2019-10-02T09:20:04.229",
"updated_at": "2019-10-02T09:20:16.718"
},
{
"id": "5d946b545f37c6157d371d86",
"project_id": "5d930b99670dc8057b7b0eb3",
"origins": [
{
"id": "5d946b545f37c6157d371d87",
"trip_id": "5d946b545f37c6157d371d86",
"created_at": "2019-10-02T09:18:12.400",
"updated_at": "2019-10-02T09:18:22.777",
"coordinates": {
"type": "Point",
"coordinates": [
77.622977,
12.917042
]
},
"reached": true,
"left": true,
"loc_type": "origin"
},
{
"id": "5d946b545f37c6157d371d88",
"trip_id": "5d946b545f37c6157d371d86",
"created_at": "2019-10-02T09:18:12.411",
"updated_at": "2019-10-02T09:18:27.624",
"coordinates": {
"type": "Point",
"coordinates": [
77.650239,
12.924304
]
},
"reached": true,
"loc_type": "origin"
},
{
"id": "5d946b545f37c6157d371d89",
"trip_id": "5d946b545f37c6157d371d86",
"created_at": "2019-10-02T09:18:12.423",
"updated_at": "2019-10-02T09:18:27.691",
"coordinates": {
"type": "Point",
"coordinates": [
77.743206,
12.954302
]
},
"reached": true,
"left": true,
"loc_type": "origin"
}
],
"destinations": [
{
"id": "5d946b545f37c6157d371d8a",
"trip_id": "5d946b545f37c6157d371d86",
"created_at": "2019-10-02T09:18:12.434",
"updated_at": "2019-10-02T09:18:12.438",
"coordinates": {
"type": "Point",
"coordinates": [
78.743206,
12.954302
]
},
"reached": false,
"loc_type": "destination"
}
],
"events": [
{
"id": "5d946b545f37c6157d371d8b",
"trip_id": "5d946b545f37c6157d371d86",
"user_id": "5d946b2f670dc8057b7b108c",
"event_type": "trip:created",
"created_at": "2019-10-02T09:18:12.451",
"is_deleted": false
},
{
"id": "5d946b5a670dc805807b0b91",
"trip_id": "5d946b545f37c6157d371d86",
"user_id": "5d946b2f670dc8057b7b108c",
"event_type": "trip:user_reached_origin",
"trip_location_id": "5d946b545f37c6157d371d87",
"user_location_id": "5d946b5a670dc805807b0b8f",
"created_at": "2019-10-02T09:18:18.087",
"is_deleted": false
},
{
"id": "5d946b5c5f37c6158337199d",
"trip_id": "5d946b545f37c6157d371d86",
"user_id": "5d946b2f670dc8057b7b108c",
"event_type": "trip:started",
"user_location_id": "5d946b5c5f37c6158337199b",
"created_at": "2019-10-02T09:18:20.469",
"is_deleted": false
},
{
"id": "5d946b5e670dc8057b7b108f",
"trip_id": "5d946b545f37c6157d371d86",
"user_id": "5d946b2f670dc8057b7b108c",
"event_type": "trip:user_left_origin",
"trip_location_id": "5d946b545f37c6157d371d87",
"user_location_id": "5d946b5e670dc8057b7b108d",
"created_at": "2019-10-02T09:18:22.782",
"is_deleted": false
},
{
"id": "5d946b615f37c6157d371d8e",
"trip_id": "5d946b545f37c6157d371d86",
"user_id": "5d946b2f670dc8057b7b108c",
"event_type": "trip:user_reached_origin",
"trip_location_id": "5d946b545f37c6157d371d89",
"user_location_id": "5d946b605f37c6157d371d8c",
"created_at": "2019-10-02T09:18:25.016",
"is_deleted": false
},
{
"id": "5d946b63670dc805807b0b94",
"trip_id": "5d946b545f37c6157d371d86",
"user_id": "5d946b2f670dc8057b7b108c",
"event_type": "trip:user_reached_origin",
"trip_location_id": "5d946b545f37c6157d371d88",
"user_location_id": "5d946b63670dc805807b0b92",
"created_at": "2019-10-02T09:18:27.624",
"is_deleted": false
},
{
"id": "5d946b63670dc805807b0b95",
"trip_id": "5d946b545f37c6157d371d86",
"user_id": "5d946b2f670dc8057b7b108c",
"event_type": "trip:user_left_origin",
"trip_location_id": "5d946b545f37c6157d371d89",
"user_location_id": "5d946b63670dc805807b0b92",
"created_at": "2019-10-02T09:18:27.696",
"is_deleted": false
},
{
"id": "5d946b63670dc805807b0b96",
"trip_id": "5d946b545f37c6157d371d86",
"user_id": "5d946b2f670dc8057b7b108c",
"event_type": "trip:completed",
"user_location_id": "5d946b63670dc805807b0b92",
"created_at": "2019-10-02T09:18:27.782",
"is_deleted": false
}
],
"user_id": "5d946b2f670dc8057b7b108c",
"is_started": true,
"is_ended": true,
"is_deleted": false,
"trip_started_at": "2019-10-02T09:18:20.165",
"trip_ended_at": "2019-10-02T09:18:27.403",
"distance_covered": 24432.62,
"duration": 7,
"is_paused": false,
"created_at": "2019-10-02T09:18:12.397",
"updated_at": "2019-10-02T09:18:27.803"
}
]
}
}

Sample Call

cURL
Go
Java
JavaScript
Python
Swift
curl -X GET \
'https://api.geospark.co/v1/api/trips/?start_date=2019-07-15&end_date=2019-07-20&page_number=1' \
-H 'Api-key: cbdd0c41a4e5461e97d1fbedb67f159e' \
-H 'Content-Type: application/json' \
-H 'cache-control: no-cache'

get
Get Trip API

https://api.geospark.co/v1/api/trips/
This API gives you the trip data of the given trip_id.
Request
Response
Headers
Api-Key
required
string
33223kjhdcscijhb5sdbsdmjsdcbj5f
Content-Type
required
string
application/json
Query Parameters
trip_id
required
string
5c40560ea1426005bd908213
200: OK
{
"status": true,
"msg": "Success.",
"code": 200,
"data": [
{
"id": "5d946bc45f37c6157d371d8f",
"project_id": "5d930b99670dc8057b7b0eb3",
"origins": [
{
"id": "5d946bc45f37c6157d371d90",
"trip_id": "5d946bc45f37c6157d371d8f",
"created_at": "2019-10-02T09:20:04.232",
"updated_at": "2019-10-02T09:20:11.730",
"coordinates": {
"type": "Point",
"coordinates": [
77.622977,
12.917042
]
},
"reached": true,
"left": true,
"loc_type": "origin"
},
{
"id": "5d946bc45f37c6157d371d91",
"trip_id": "5d946bc45f37c6157d371d8f",
"created_at": "2019-10-02T09:20:04.245",
"updated_at": "2019-10-02T09:20:16.638",
"coordinates": {
"type": "Point",
"coordinates": [
77.650239,
12.924304
]
},
"reached": true,
"left": true,
"loc_type": "origin"
},
{
"id": "5d946bc45f37c6157d371d92",
"trip_id": "5d946bc45f37c6157d371d8f",
"created_at": "2019-10-02T09:20:04.257",
"updated_at": "2019-10-02T09:20:16.710",
"coordinates": {
"type": "Point",
"coordinates": [
77.743206,
12.954302
]
},
"reached": true,
"loc_type": "origin"
}
],
"destinations": [
{
"id": "5d946bc45f37c6157d371d93",
"trip_id": "5d946bc45f37c6157d371d8f",
"created_at": "2019-10-02T09:20:04.269",
"updated_at": "2019-10-02T09:20:04.274",
"coordinates": {
"type": "Point",
"coordinates": [
78.743206,
12.954302
]
},
"reached": false,
"loc_type": "destination"
}
],
"events": [
{
"id": "5d946bc45f37c6157d371d94",
"trip_id": "5d946bc45f37c6157d371d8f",
"user_id": "5d946b665f37c6158337199e",
"event_type": "trip:created",
"created_at": "2019-10-02T09:20:04.287",
"is_deleted": false
},
{
"id": "5d946bc6670dc8057b7b1094",
"trip_id": "5d946bc45f37c6157d371d8f",
"user_id": "5d946b665f37c6158337199e",
"event_type": "trip:user_reached_origin",
"trip_location_id": "5d946bc45f37c6157d371d90",
"user_location_id": "5d946bc6670dc8057b7b1092",
"created_at": "2019-10-02T09:20:06.707",
"is_deleted": false
},
{
"id": "5d946bc95f37c615833719a1",
"trip_id": "5d946bc45f37c6157d371d8f",
"user_id": "5d946b665f37c6158337199e",
"event_type": "trip:started",
"user_location_id": "5d946bc95f37c6158337199f",
"created_at": "2019-10-02T09:20:09.523",
"is_deleted": false
},
{
"id": "5d946bcb670dc805807b0b99",
"trip_id": "5d946bc45f37c6157d371d8f",
"user_id": "5d946b665f37c6158337199e",
"event_type": "trip:user_left_origin",
"trip_location_id": "5d946bc45f37c6157d371d90",
"user_location_id": "5d946bcb670dc805807b0b97",
"created_at": "2019-10-02T09:20:11.735",
"is_deleted": false
},
{
"id": "5d946bce5f37c6157d371d97",
"trip_id": "5d946bc45f37c6157d371d8f",
"user_id": "5d946b665f37c6158337199e",
"event_type": "trip:user_reached_origin",
"trip_location_id": "5d946bc45f37c6157d371d91",
"user_location_id": "5d946bce5f37c6157d371d95",
"created_at": "2019-10-02T09:20:14.099",
"is_deleted": false
},
{
"id": "5d946bd0670dc8057b7b1097",
"trip_id": "5d946bc45f37c6157d371d8f",
"user_id": "5d946b665f37c6158337199e",
"event_type": "trip:user_left_origin",
"trip_location_id": "5d946bc45f37c6157d371d91",
"user_location_id": "5d946bd0670dc8057b7b1095",
"created_at": "2019-10-02T09:20:16.643",
"is_deleted": false
},
{
"id": "5d946bd0670dc8057b7b1098",
"trip_id": "5d946bc45f37c6157d371d8f",
"user_id": "5d946b665f37c6158337199e",
"event_type": "trip:user_reached_origin",
"trip_location_id": "5d946bc45f37c6157d371d92",
"user_location_id": "5d946bd0670dc8057b7b1095",
"created_at": "2019-10-02T09:20:16.710",
"is_deleted": false
}
],
"user_id": "5d946b665f37c6158337199e",
"is_started": true,
"is_ended": false,
"is_deleted": false,
"trip_started_at": "2019-10-02T09:20:09.229",
"is_paused": false,
"created_at": "2019-10-02T09:20:04.229",
"updated_at": "2019-10-02T09:20:16.718"
}
]
}

Sample Call

cURL
Go
Java
JavaScript
Python
Swift
curl -X GET \
'https://api.geospark.co/v1/api/trips/?trip_id=5d947fcb96940667bc0a1a5e' \
-H 'Api-key: cbdd0c41a4e5461e97d1fbedb67f159e' \
-H 'Content-Type: application/json' \
-H 'Postman-Token: cd0dc842-4ece-4f27-a9e2-62032ac47b94' \
-H 'cache-control: no-cache'

post
Create Trip API

https://api.geospark.co/v1/api/trips/
This API helps you to create a new trip with origin, destination and user.
Request
Response
Headers
Api-Key
required
string
Your API Key Here
Content-Type
required
string
application/json
Body Parameters
destinations
optional
array
Destination location in [long, lat] format Eg. [[77.700475, 12.957005]]
origins
optional
array
Origin location in [long, lat] format Eg. [[77.677270, 12.914132]]
user_id
optional
string
User id of the device to be assigned this trip.
200: OK
{
"status": true,
"msg": "Success.",
"code": 201,
"data": [
{
"id": "5d946da25f37c6157d371d98",
"origins": [
{
"id": "5d946da25f37c6157d371d99",
"trip_id": "5d946da25f37c6157d371d98",
"created_at": "2019-10-02T09:28:02.952",
"updated_at": "2019-10-02T09:28:02.956",
"coordinates": {
"type": "Point",
"coordinates": [
77.622977,
12.917042
]
},
"reached": false,
"loc_type": "origin"
},
{
"id": "5d946da25f37c6157d371d9a",
"trip_id": "5d946da25f37c6157d371d98",
"created_at": "2019-10-02T09:28:02.964",
"updated_at": "2019-10-02T09:28:02.968",
"coordinates": {
"type": "Point",
"coordinates": [
77.650239,
12.924304
]
},
"reached": false,
"loc_type": "origin"
}
],
"destinations": [
{
"id": "5d946da25f37c6157d371d9b",
"trip_id": "5d946da25f37c6157d371d98",
"created_at": "2019-10-02T09:28:02.976",
"updated_at": "2019-10-02T09:28:02.981",
"coordinates": {
"type": "Point",
"coordinates": [
78.743206,
12.954302
]
},
"reached": false,
"loc_type": "destination"
},
{
"id": "5d946da25f37c6157d371d9c",
"trip_id": "5d946da25f37c6157d371d98",
"created_at": "2019-10-02T09:28:02.988",
"updated_at": "2019-10-02T09:28:02.993",
"coordinates": {
"type": "Point",
"coordinates": [
77.743206,
12.954302
]
},
"reached": false,
"loc_type": "destination"
}
],
"events": [
{
"id": "5d946da35f37c6157d371d9d",
"trip_id": "5d946da25f37c6157d371d98",
"user_id": "5d946b665f37c6158337199e",
"event_type": "trip:created",
"created_at": "2019-10-02T09:28:03.006",
"is_deleted": false
}
],
"user_id": "5d946b665f37c6158337199e",
"is_started": false,
"is_ended": false,
"is_deleted": false,
"is_paused": false,
"created_at": "2019-10-02T09:28:02.949",
"updated_at": "2019-10-02T09:28:03.015",
"trip_tracking_url": "https://trips.gs/NWQ5NDZkYTI1ZjM3YzYxNTdkMzcxZDk4fHNmZHNnZHNh"
}
]
}

Sample Call

cURL
JavaScript
Python
Java
Swift
Go
curl -X POST \
https://api.geospark.co/v1/api/trips/ \
-H 'Api-key: cbdd0c41a4e5461e97d1fbedb67f159e' \
-H 'Content-Type: application/json' \
-H 'Postman-Token: 8f013cd3-b87c-4264-ba35-4c4f5d946572' \
-H 'cache-control: no-cache' \
-d '{
"user_id": "5d9450ace47bae6d70064a9b",
"origins": [[77.622977,12.917042],[77.650239,12.924304], [77.743206, 12.954302]],
"destinations":[[78.743206, 12.954302]]
}'

put
Update Trip API

https://api.geospark.co/v1/api/trips/
This API helps you to update the origin, destination or user_id for given trip_id.
Request
Response
Headers
Api-Key
required
string
Your API Key Here
Content-Type
required
string
application/json
Body Parameters
trip_id
required
string
Trip id which needs to be modified. Eg. 5cd0299d77aebe2d78758d32
destinations
optional
array
Destination location in [long, lat] format Eg. [[77.700475, 12.957005]]
origins
optional
array
Origin location in [long, lat] format Eg. [[77.677270, 12.914132]]
user_id
optional
string
User id of the device to be assigned to this trip. Eg. 5ccea6ed77aebe1f28fbcc24
200: OK
{
"status": true,
"msg": "Success.",
"code": 201,
"data": [
{
"id": "5d946da25f37c6157d371d98",
"origins": [
{
"id": "5d946da25f37c6157d371d99",
"trip_id": "5d946da25f37c6157d371d98",
"created_at": "2019-10-02T09:28:02.952",
"updated_at": "2019-10-02T09:28:02.956",
"coordinates": {
"type": "Point",
"coordinates": [
77.622977,
12.917042
]
},
"reached": false,
"loc_type": "origin"
},
{
"id": "5d946da25f37c6157d371d9a",
"trip_id": "5d946da25f37c6157d371d98",
"created_at": "2019-10-02T09:28:02.964",
"updated_at": "2019-10-02T09:28:02.968",
"coordinates": {
"type": "Point",
"coordinates": [
77.650239,
12.924304
]
},
"reached": false,
"loc_type": "origin"
}
],
"destinations": [
{
"id": "5d946da25f37c6157d371d9b",
"trip_id": "5d946da25f37c6157d371d98",
"created_at": "2019-10-02T09:28:02.976",
"updated_at": "2019-10-02T09:28:02.981",
"coordinates": {
"type": "Point",
"coordinates": [
78.743206,
12.954302
]
},
"reached": false,
"loc_type": "destination"
},
{
"id": "5d946da25f37c6157d371d9c",
"trip_id": "5d946da25f37c6157d371d98",
"created_at": "2019-10-02T09:28:02.988",
"updated_at": "2019-10-02T09:28:02.993",
"coordinates": {
"type": "Point",
"coordinates": [
77.743206,
12.954302
]
},
"reached": false,
"loc_type": "destination"
}
],
"events": [
{
"id": "5d946da35f37c6157d371d9d",
"trip_id": "5d946da25f37c6157d371d98",
"user_id": "5d946b665f37c6158337199e",
"event_type": "trip:created",
"created_at": "2019-10-02T09:28:03.006",
"is_deleted": false
},
{
"id": "5d946e615f37c6157d371d9e",
"trip_id": "5d946da25f37c6157d371d98",
"user_id": "5d946b665f37c6158337199e",
"event_type": "trip:user_updated",
"created_at": "2019-10-02T09:31:13.698",
"is_deleted": false
}
],
"user_id": "5d946e5b670dc8057b7b1099",
"is_started": false,
"is_ended": false,
"is_deleted": false,
"is_paused": false,
"created_at": "2019-10-02T09:28:02.949",
"updated_at": "2019-10-02T09:31:13.780"
}
]
}

Sample Call

cURL
Go
Java
JavaScript
Python
Swift
curl -X PUT \
https://api.geospark.co/v1/api/trips/ \
-H 'Api-key: cbdd0c41a4e5461e97d1fbedb67f159e' \
-H 'Content-Type: application/json' \
-H 'Postman-Token: e002841e-d873-4a9e-ac3b-c33418effe82' \
-H 'cache-control: no-cache' \
-d '{
"trip_id": "5d947fcb96940667bc0a1a5e",
"user_id": "5d9450ace47bae6d70064a9b",
"origins": [[77.622977,12.917042]],
"destinations":[[78.743206, 12.954302]]
}'