Trips

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

get
Get Trips List API

https://api.geospark.co/v1/api/trip/
This API gives you the list of all trips (both active and ended) of an user. You can view trip summary for the users. It will help you track your user's completed and ongoing trips. You will get a concise information like trip start time, end time, start location, end location, Trip duration and distance covered.
Request
Response
Headers
Api-Key
required
string
33223kjhdcscijhb5sdbsdmjsdcbj5f
Content-Type
required
string
application/json
Query Parameters
app_id
optional
string
app_id to identify the device_platform of the given user. Input Data: 5bc83d7f02a89b01450c5a6c_1
user_id
required
string
Returns the trips of the user identified by this parameter. Input Data: 5bd3086002a89b26a5d2a1d2
trip_type
optional
integer
This field can be used to select the trip type i.e if trip_type=0 only ended trip will be returned and if trip_type=1 only ongoing trip will be returned. Input Data: 0 / 1
sort_by
optional
string
This field can be used to sort the response in recent first order. If sort_by=started_at then response provided will be sorted by trip start time and if sort_by=ended_at then response provided will be sorted by trip end time. Input Data: started_at / ended_at
start_date
optional
string
This field can be used for defining a start date from which the trip list of a user needs to return. Input Data: 2019-02-20
end_date
optional
string
This field can be used to define a range of time till when the last document needs to be provided. And should always be greater than start_date. If end_date provided the start date should be provided. If start_date is provided and end_date is not provided then you will get the trip list of a user for given start_date only. If both start_date and end_date is not provided then current date will be considered as start_date and response will be for current date only. Input Data: 2019-02-21
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.
200: OK
JSON
{
"status": true,
"msg": "Success.",
"code": 200,
"data": {
"next_page": null,
"pages": 1,
"prev_page": null,
"trips": [
{
"trip_id": "5c40560ea1426005bd908213",
"description": "Evans house",
"trip_started_at": "2019-01-17T10:16:45.000",
"trip_ended_at": "2019-01-17T10:17:00.000",
"start_address": "160 hsr layout near BDA Complex, Bengaluru,Karnataka 560102, India",
"end_address": "160 hsr layout near BDA Complex, Bengaluru,Karnataka 560102, India",
"distance_covered": 3.75,
"duration": 15
},
{
"trip_id": "5c4354dca142600f546975b7",
"description": "House of commons",
"trip_started_at": "2019-01-19T16:48:26.000",
"trip_ended_at": "2019-01-19T19:15:28.000",
"start_address": "773, Srinivagilu Main Rd, Koramangala 4thBlock, Koramangala, Bengaluru, Karnataka 560034, India",
"end_address": "#95, B.D.A Complex, Above Post office, HSRLayout, Bengaluru, Karnataka 560102, India",
"distance_covered": 3768.72,
"duration": 8822
},
{
"trip_id": "5c48318ca1426051057cbbdf",
"description": "Kormangla",
"trip_started_at": "2019-01-23T09:19:06.000",
"start_address": "#163, 9th Main road, 6th Sector, HSR Layout,Bengaluru, Karnataka 560102, India"
}
]
}
}

Sample Call

cURL
JavaScript
Python
Java
Swift
Go
curl -X GET \
'https://api.geospark.co/v1/api/trip/?
user_id=5bd3086002a89b26a5d2a1d2&app_id=5bc83d7f02a89b01450c5a6c_1' \
-H 'Api-key: YOUR-API-KEY'

get
Get Trip API

https://api.geospark.co/v1/api/trip/
This API gives you the trip data of the given trip_id. You can view the entire trip summary.
Request
Response
Headers
Api-Key
optional
string
33223kjhdcscijhb5sdbsdmjsdcbj5f
Content-Type
required
string
application/json
Query Parameters
trip_id
required
string
5c40560ea1426005bd908213
200: OK
{
"status": true,
"msg": "Success.",
"code": 200,
"data": [
{
"trip_id": "5c40560ea1426005bd908213",
"description": "Evans house",
"trip_started_at": "2019-01-17T10:16:45.000",
"trip_ended_at": "2019-01-17T10:17:00.000",
"start_address": "160 hsr layout near BDA Complex, Bengaluru,Karnataka 560102, India",
"end_address": "160 hsr layout near BDA Complex, Bengaluru,Karnataka 560102, India",
"distance_covered": 3.75,
"duration": 15
}
]
}

Sample Call

cURL
curl -X GET \
'https://api.geospark.co/v1/api/trip/?trip_id=5c40560ea1426005bd908213' \
-H 'Api-key: YOUR-API-KEY'

Metrics:

  • Distance covered is calculated in meters.

  • Duration is calculated in minutes.

  • This API returns the list of trips (ongoing and completed) of a user for a given date, with short summary of each trip.

get
Get Trips Route API

https://api.geospark.co/v1/api/trip/route/
This API gives the locations covered within a trip by a user.
Request
Response
Headers
Api-Key
required
string
33223kjhdcscijhb5sdbsdmjsdcbj5f
Content-Type
required
string
application/json
Query Parameters
trip_id
required
string
Response contains the locations identified by this field. Input Data: 5bd3095502a89b2949e7f82b
app_id
optional
string
app_id to identify the device_platform of the given user. Input Data: 5bc83d7f02a89b01450c5a6c_1
200: OK
JSON
{
"status": true,
"msg": "Success.",
"code": 200,
"data": [
{
"coordinates": [
79.48695,
12.98266
],
"altitude": 23.33,
"activity": "WALK",
"recorded_at": "2018-12-15T11:44:00.270"
},
{
"coordinates": [
79.44593,
12.96793
],
"altitude": 23.33,
"activity": "STOP",
"started_at": "2018-12-15T13:00:18.295"
},
{
"coordinates": [
79.47593,
12.92793
],
"altitude": 23.33,
"activity": "DRIVE",
"recorded_at": "2018-12-15T13:23:18.295"
},
{
"coordinates": [
79.47513,
12.92733
],
"altitude": 22.33,
"activity": "BICYCLE",
"recorded_at": "2018-12-15T14:23:18.295"
},
{
"coordinates": [
79.47519,
12.92735
],
"altitude": 24.33,
"activity": "BICYCLE",
"recorded_at": "2018-12-15T14:23:18.295"
},
{
"coordinates": [
79.47413,
12.92133
],
"altitude": 23.33,
"activity": "BICYCLE",
"recorded_at": "2018-12-15T14:23:18.295"
}
]
}

Sample Call

cURL
JavaScript
Python
Java
Swift
Go
curl -X GET \
'https://api.geospark.co/v1/api/trip/route/?trip_id=5bd3095502a89b2949e7f82b&app_id=5bc83d7f02a89b01450c5a6c_1' \
-H 'Api-key: ad0b961be07b4b0c94f6b59df489edc1'