Users, Locations and Insights

This set of APIs will help in fetching the user data, user location data, insights and update the user events.
  • Pass your secret API key in the header

  • API parameter page_number, gives a maximum of 10 entries per page in response

  • Suffix of app_id represents device platform , i.e. "_1" for android and "_2" for iOS

  • For list APIs the "next_page" and "prev_page" fields will be "null" if not present. and "pages" will be 0 if not present.

get
Get User API

https://api.geospark.co/v1/api/user/
Get User API provides the list of users who are using your app corresponding to the project secret API key provided.
Request
Response
Request
Headers
Content-Type
required
string
application/json
Api-Key
required
string
33223kjhdcscijhb5sdbsdmjsdcbj5f
Query Parameters
user_id
optional
string
For searching a particular user. Note: Use this field for only searching. No other field should be combined with it. E.g. /api/user/?user_id=5c2f43e8fb979679beba0cce Input Data: 5bd2aee1eec1a55d8faf1193
timezone_offset
optional
string
If timezone is provided then the response will be returned as per provided local timezone. If the timezone is not passed, response will be returned in UTC. Input Data: Asia/Kolkata
start_date
optional
string
This field can be used for defining a start date from which the list of users needs to 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 Data: 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 field, it is safe to assume the pages are exhausted.
Response
200: OK
JSON
{
"status": true,
"msg": "Success.",
"code": 200,
"data": {
"next_page": null,
"pages": 1,
"prev_page": null,
"account_id": "5d15e6029694061560ed8d64",
"users": [
{
"id": "5d947b80e47bae6d700650cd",
"app_id": "5d15e65a9694061560ed8de7_1",
"device_token": "c6IDEE9eq7A:APA91bEg_q3zDuKNmlwIsSdDAdycCxrM-xGA8FcCRwIrTt5gCXCbAQWg2pUc25dB_-MbWeBrEEtgkCN0lbkwjuqNhls7pDotBSzdHTsyLOPVJ8i2dnrGSWj8aLHHYwCkX5xRCey2SeEe",
"device_uuid": "51ad2d53-9057-49c3-93cf-a4817045bf48",
"description": "James",
"brand": "asus",
"model": "ASUS_Z012DB",
"os_version": "26",
"sdk_version": "2.1.1",
"device_arn": "arn:aws:sns:us-east-1:218937252071:endpoint/GCM/app_5d15e65a9694061560ed8de7_1_ddba9c68-dee2-4e33-8258-ff7f7515a672/4f497606-3ae6-3c1d-99f6-a015af4fd42d",
"geofence_events": true,
"motion_events": true,
"trips_events": true,
"is_deleted": false,
"created_at": "2019-10-02T15:57:11.970",
"last_location_update": {
"id": "5d947b82e47bae6d700650ce",
"coordinates": {
"type": "Point",
"coordinates": [
77.6354213,
12.9143926
]
},
"speed": 0.0,
"accuracy": 26.04800033569336,
"altitude": 795.8999633789062,
"activity": "WALK",
"recorded_at": "2019-10-02T10:27:14.053",
"timezone_offset": "+0530",
"net_stat": true,
"gps_stat": true,
"motion_stat": true,
"app_stat": "MANUAL",
"battery_remaining": 57,
"bat_stat": "Unknown",
"bat_saver_mode": false,
"location_permission": true,
"airplane_mode": false,
"created_at": "2019-10-02T10:27:14.256"
}
},
{
"id": "5d94703396940667bc0a1732",
"app_id": "5d15e65a9694061560ed8de7_1",
"device_token": "d1QlKpq-QJU:APA91bFCKZIG3Ypi6n6Z5zZyo6w-E0ZJg6GRxoT7aImxURvlFDtlRkGllykc6g3kW7C0aPDYN2L8ouMr--WVDrJA3tU0pHRA-ENuNc0PIZUqipqKNfmq4NfELNGIjzRGJPtypK0PIKIs",
"device_uuid": "3da30854-1525-48a8-812d-bb17c797df47",
"description": "sujith",
"brand": "samsung",
"model": "SM-G950F",
"os_version": "28",
"sdk_version": "2.1.1",
"device_arn": "arn:aws:sns:us-east-1:218937252071:endpoint/GCM/app_5d15e65a9694061560ed8de7_1_ddba9c68-dee2-4e33-8258-ff7f7515a672/76560c7e-dfed-3b0f-85a8-8df5b7d75e19",
"geofence_events": true,
"motion_events": true,
"trips_events": true,
"is_deleted": false,
"created_at": "2019-10-02T15:08:59.020",
"last_location_update": {
"id": "5d94703596940667bc0a1736",
"coordinates": {
"type": "Point",
"coordinates": [
77.6353995,
12.9144113
]
},
"speed": 0.0,
"accuracy": 28.9419994354248,
"altitude": 795.899963378906,
"activity": "STOP",
"address": "GeoSpark, 164, 9th Main Road, Sector 5, HSR Layout Ward, Bommanahalli Zone, Bengaluru, Bangalore Urban, Karnataka, 560102, India"
"timezone_offset": "+0530",
"started_at": "2019-10-02T09:38:59.883",
"ended_at": "2019-10-02T09:39:00.512",
"net_stat": true,
"gps_stat": true,
"motion_stat": true,
"app_stat": "FOREGROUND",
"battery_remaining": 94,
"bat_stat": "Unknown",
"bat_saver_mode": false,
"location_permission": true,
"airplane_mode": false,
"created_at": "2019-10-02T09:39:01.371"
}
}
]
}
}

Sample Call

cURL
JavaScript
Python
Java
Swift
Go
cURL
curl -X GET \
'https://api.geospark.co/v1/api/user/?start_date=2019-01-10&end_date=2019-01-12&timezone_offset=Asia/Kolkata' \
-H 'Api-Key: 28c44e3f33de40fbafa0f9dad776b6b2'
JavaScript
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.geospark.co/v1/api/user/?start_date=2019-01-10&end_date=2019-01-12&timezone_offset=Asia/Kolkata"",
"method": "GET",
"headers": {
"Api-Key": "28c44e3f33de40fbafa0f9dad776b6b2"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
Python
import requests
url = "https://api.geospark.co/v1/api/user/"
querystring = {"start_date":"2019-01-10","end_date":"2019-01-12","timezone_offset":"Asia/Kolkata"}
headers = {
'Api-Key': "28c44e3f33de40fbafa0f9dad776b6b2"
}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
Java
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.geospark.co/v1/api/user/?start_date=2019-01-10&end_date=2019-01-12&timezone_offset=Asia/Kolkata")
.get()
.addHeader("Api-Key", "28c44e3f33de40fbafa0f9dad776b6b2")
.build();
Response response = client.newCall(request).execute();
Swift
import Foundation
let headers = [
"Api-Key": "28c44e3f33de40fbafa0f9dad776b6b2"
]
let request = NSMutableURLRequest(url: NSURL(string: "https://api.geospark.co/v1/api/user/?start_date=2019-01-10&end_date=2019-01-12&timezone_offset=Asia/Kolkata")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
Go
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.geospark.co/v1/api/user/?start_date=2019-01-10&end_date=2019-01-12&timezone_offset=Asia/Kolkata"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Api-Key", "28c44e3f33de40fbafa0f9dad776b6b2")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}

get
Get Location API

https://api.geospark.co/v1/api/location/
Get Location API provides the list of locations of the users who are using your app for a specified project corresponding to the project secret API key provided by you.
Request
Response
Request
Headers
Content-Type
required
string
application/json
Api-Key
required
string
33223kjhdcscijhb5sdbsdmjsdcbj5f
Query Parameters
points_encoded
optional
boolean
This field can be used to get the location data in encoded polyline and time aware polyline. This returns only the data for current date and to get the other data using start_date and end_date is recommended. It's false by default. points_encoded and timezone-offset are exclusive and can't be used together.
user_id
required
string
Filters the location data for the given user_id. Input Data: 5bb3177a02a89b3c7a6a8d4f
timezone_offset
optional
string
If timezone is provided then the response will be returned as per provided local timezone. If the timezone is not passed, response will be returned in UTC. If points_encoded value is true, then this value will be UTC by default. Input Data: Asia/Kolkata
start_date
optional
string
This field can be used for defining a start date from which the list of user's locations needs to 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 Data: 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 field, it is safe to assume the pages are exhausted. If points_encoded value is true, then this value will not be considered.
Response
200: OK
JSON
{
"status": true,
"msg": "Success.",
"code": 200,
"data": {
"next_page": 2,
"pages": 15,
"prev_page": null,
"app_id": "5d68c56255c9d50640802ff8_2",
"user_id": "5d931e4896940667bc0834dd",
"locations": [
{
"id": "5d93696096940667bc0893fe",
"coordinates": {
"type": "Point",
"coordinates": [
77.63033406133458,
13.01788769586474
]
},
"speed": 0.0,
"accuracy": 10.0,
"altitude": 897.4580940078257,
"activity": "STOP",
"address": "GeoSpark, 164, 9th Main Road, Sector 5, HSR Layout Ward, Bommanahalli Zone, Bengaluru, Bangalore Urban, Karnataka, 560102, India"
"timezone_offset": "+0530",
"started_at": "2019-10-01T14:57:05.444",
"ended_at": "2019-10-01T14:57:35.986",
"net_stat": true,
"gps_stat": true,
"motion_stat": true,
"app_stat": "BACKGROUND",
"battery_remaining": 98,
"bat_stat": "Charging",
"created_at": "2019-10-01T14:57:36.300"
},
{
"id": "5d93692b96940667bc08939a",
"coordinates": {
"type": "Point",
"coordinates": [
77.63077092364209,
13.017818061647022
]
},
"speed": 18.0,
"accuracy": 5.0,
"altitude": 902.267219543457,
"activity": "DRIVE",
"timezone_offset": "+0530",
"net_stat": true,
"gps_stat": true,
"motion_stat": true,
"app_stat": "BACKGROUND",
"battery_remaining": 97,
"bat_stat": "Charging",
"created_at": "2019-10-01T14:56:43.420",
"recorded_at": "2019-10-01T14:56:43.092"
},
{
"id": "5d93690396940667bc089332",
"coordinates": {
"type": "Point",
"coordinates": [
77.63258644386906,
13.017401564878428
]
},
"speed": 20.0,
"accuracy": 5.0,
"altitude": 902.8652420043945,
"activity": "DRIVE",
"timezone_offset": "+0530",
"net_stat": true,
"gps_stat": true,
"motion_stat": true,
"app_stat": "BACKGROUND",
"battery_remaining": 97,
"bat_stat": "Charging",
"created_at": "2019-10-01T14:56:03.421",
"recorded_at": "2019-10-01T14:56:03.078"
},
{
"id": "5d9368e196940667bc0892e5",
"coordinates": {
"type": "Point",
"coordinates": [
77.63434211730737,
13.016522638511859
]
},
"speed": 22.0,
"accuracy": 10.0,
"altitude": 907.4284744262695,
"activity": "DRIVE",
"timezone_offset": "+0530",
"net_stat": true,
"gps_stat": true,
"motion_stat": true,
"app_stat": "BACKGROUND",
"battery_remaining": 97,
"bat_stat": "Charging",
"created_at": "2019-10-01T14:55:29.285",
"recorded_at": "2019-10-01T14:55:29.082"
},
{
"id": "5d9368ca96940667bc0892b9",
"coordinates": {
"type": "Point",
"coordinates": [
77.63618052012998,
13.01624611952623
]
},
"speed": 15.0,
"accuracy": 5.0,
"altitude": 909.6889724731445,
"activity": "DRIVE",
"timezone_offset": "+0530",
"net_stat": true,
"gps_stat": true,
"motion_stat": true,
"app_stat": "BACKGROUND",
"battery_remaining": 97,
"bat_stat": "Charging",
"created_at": "2019-10-01T14:55:06.267",
"recorded_at": "2019-10-01T14:55:06.081"
},
{
"id": "5d93688f96940667bc089232",
"coordinates": {
"type": "Point",
"coordinates": [
77.6364021391822,
13.017499802693466
]
},
"speed": 23.0,
"accuracy": 10.0,
"altitude": 908.5708084106445,
"activity": "DRIVE",
"timezone_offset": "+0530",
"net_stat": true,
"gps_stat": true,
"motion_stat": true,
"app_stat": "BACKGROUND",
"battery_remaining": 97,
"bat_stat": "Charging",
"created_at": "2019-10-01T14:54:07.437",
"recorded_at": "2019-10-01T14:54:07.086"
},
{
"id": "5d93686de47bae6d7004c5d3",
"coordinates": {
"type": "Point",
"coordinates": [
77.63686545491203,
13.01945139072632
]
},
"speed": 19.0,
"accuracy": 10.068562831803998,
"altitude": 909.973518371582,
"activity": "DRIVE",
"timezone_offset": "+0530",
"net_stat": true,
"gps_stat": true,
"motion_stat": true,
"app_stat": "BACKGROUND",
"battery_remaining": 97,
"bat_stat": "Charging",
"created_at": "2019-10-01T14:53:33.295",
"recorded_at": "2019-10-01T14:53:33.091"
},
{
"id": "5d93684596940667bc0891b4",
"coordinates": {
"type": "Point",
"coordinates": [
77.63702449676983,
13.021435016003837
]
},
"speed": 10.0,
"accuracy": 11.166095059679792,
"altitude": 910.216194152832,
"activity": "DRIVE",
"timezone_offset": "+0530",
"net_stat": true,
"gps_stat": true,
"motion_stat": true,
"app_stat": "BACKGROUND",
"battery_remaining": 97,
"bat_stat": "Charging",
"created_at": "2019-10-01T14:52:53.272",
"recorded_at": "2019-10-01T14:52:53.101"
},
{
"id": "5d93680ae47bae6d7004c4c5",
"coordinates": {
"type": "Point",
"coordinates": [
77.63657012402616,
13.02296174115325
]
},
"speed": 0.0,
"accuracy": 10.0,
"altitude": 902.1354044576965,
"activity": "STOP",
"address": "GeoSpark, 164, 9th Main Road, Sector 5, HSR Layout Ward, Bommanahalli Zone, Bengaluru, Bangalore Urban, Karnataka, 560102, India"
"timezone_offset": "+0530",
"started_at": "2019-10-01T14:51:23.087",
"ended_at": "2019-10-01T14:51:53.976",
"net_stat": true,
"gps_stat": true,
"motion_stat": true,
"app_stat": "BACKGROUND",
"battery_remaining": 97,
"bat_stat": "Charging",
"created_at": "2019-10-01T14:51:54.176"
}
]
}
}

Sample Call

cURL
JavaScript
Python
Java
Swift
Go
cURL
curl -X GET \
'http://api.geospark.co/v1/api/location/?user_id=5c90e5b19533a37823dd4331' \
-H 'Api-Key: aef49fac20f9475ebb880319b0c54d00' \
-H 'Postman-Token: 99aa945c-7fbd-4642-ab9c-ca17e66d2579' \
-H 'cache-control: no-cache'
JavaScript
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.geospark.co/v1/api/location/?user_id=5bb3177a02a89b3c7a6a8d4f&start_date=2019-01-06&end_date=2019-01-09&page_number=1",
"method": "GET",
"headers": {
"Api-Key": "eade6d3a72924eb895a19feb44895372"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
Python
import requests
url = "https://api.geospark.co/v1/api/location/"
querystring = {"user_id":"5bb3177a02a89b3c7a6a8d4f","start_date":"2019-01-06","end_date":"2019-01-09","page_number":"1"}
headers = {
'Api-Key': "eade6d3a72924eb895a19feb44895372"
}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
Java
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.geospark.co/v1/api/location/?user_id=5bb3177a02a89b3c7a6a8d4f&start_date=2019-01-06&end_date=2019-01-09&page_number=1")
.get()
.addHeader("Api-Key", "eade6d3a72924eb895a19feb44895372")
.build();
Response response = client.newCall(request).execute();
Swift
import Foundation
let headers = [
"Api-Key": "eade6d3a72924eb895a19feb44895372"
]
let request = NSMutableURLRequest(url: NSURL(string: "https://api.geospark.co/v1/api/location/?user_id=5bb3177a02a89b3c7a6a8d4f&start_date=2019-01-06&end_date=2019-01-09&page_number=1")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
Go
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.geospark.co/v1/api/location/?user_id=5bb3177a02a89b3c7a6a8d4f&start_date=2019-01-06&end_date=2019-01-09&page_number=1"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Api-Key", "eade6d3a72924eb895a19feb44895372")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}

put
Update User API

https://api.geospark.co/v1/api/user/
This API lets you enable or disable the events for the given user_id.
Request
Response
Request
Headers
content-type
optional
string
application/json
Api-key
optional
string
33223kjhdcscijhb5sdbsdmjsdcbj5f
Body Parameters
user_id
required
string
User id which need to be updated.
motion_events
optional
boolean
Turn on/off events for change in activity.
geofence_events
optional
boolean
Turn on/off geofence events.
trips_events
optional
boolean
Turn on/off trips events.
Response
200: OK
{
"status": true,
"msg": "Success.",
"code": 200,
"data": {
"id": "5d948d735f37c615833719d2",
"account_id": "5d01de8aaa6ad90610ac7aaf",
"app_id": "5d948d61670dc805827b09b5_2",
"device_token": "devicetoken",
"device_uuid": null,
"description": "postman device test",
"brand": "Samsung",
"model": "S8",
"group_id": null,
"os_version": "8.1",
"sdk_version": "2.1",
"device_arn": null,
"geofence_events": true,
"motion_events": true,
"trips_events": true,
"metadata": null,
"is_deleted": false,
"created_at": "2019-10-02T11:43:47.765",
"updated_at": "2019-10-02T12:20:34.749"
}
}

Sample Call

cURL
Go
JavaScript
Python
Java
cURL
curl -X PUT \
http://api.geospark.co/v1/api/user/ \
-H 'Api-Key: cbdd0c41a4e5461e97d1fbedb67f159f' \
-H 'Content-Type: application/json' \
-d '{
"user_id": "5d948d735f37c615833719d2",
"geofence_events": true,
"motion_events": true,
"trips_events": true
}'
Go
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "http://api.geospark.co/v1/api/user/"
payload := strings.NewReader("{\t\n\t\"user_id\": \"5d948d735f37c615833719d2\",\n\t\"geofence_events\": true,\n\t\"motion_events\": true,\n\t\"trips_events\": true\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Api-Key", "cbdd0c41a4e5461e97d1fbedb67f159f")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
JavaScript
var settings = {
"async": true,
"crossDomain": true,
"url": "http://api.geospark.co/v1/api/user/",
"method": "PUT",
"headers": {
"Api-Key": "cbdd0c41a4e5461e97d1fbedb67f159f",
"Content-Type": "application/json"
},
"processData": false,
"data": "{\t\n\t\"user_id\": \"5d948d735f37c615833719d2\",\n\t\"geofence_events\": true,\n\t\"motion_events\": true,\n\t\"trips_events\": true\n}"
}
$.ajax(settings).done(function (response) {
console.log(response);
});
Python
import requests
url = "http://api.geospark.co/v1/api/user/"
payload = "{\t\n\t\"user_id\": \"5d948d735f37c615833719d2\",\n\t\"geofence_events\": true,\n\t\"motion_events\": true,\n\t\"trips_events\": true\n}"
headers = {
'Api-Key': "cbdd0c41a4e5461e97d1fbedb67f159f",
'Content-Type': "application/json"
}
response = requests.request("PUT", url, data=payload, headers=headers)
print(response.text)
Java
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\t\n\t\"user_id\": \"5d948d735f37c615833719d2\",\n\t\"geofence_events\": true,\n\t\"motion_events\": true,\n\t\"trips_events\": true\n}");
Request request = new Request.Builder()
.url("http://api.geospark.co/v1/api/user/")
.put(body)
.addHeader("Api-Key", "cbdd0c41a4e5461e97d1fbedb67f159f")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();

post
Get Nearby Users API

https://api.geospark.co/v1/api/user/nearby/
This API will provide the list of near by users for the provided user_id or given location point based on the users latest location update.
Request
Response
Request
Headers
Content-Type
required
string
application/json
Api-Key
required
string
33223kjhdcscijhb5sdbsdmjsdcbj5f
Body Parameters
user_id
optional
string
user_id to find the users around
radius
optional
integer
Default is taken as 1000 metres
geometry
optional
object
{ "coordinates": [ 81.162067, 16.871602 ], "type": "Point" // Can be a polygon }
page
optional
integer
2
Response
200: OK
Returns the list of users falling under the radius of location point or polygon provided based on their latest location update. When user_id is passed as reference of location point, the response involves the location details of reference user_id also.
JSON
{
"status": true,
"msg": "Success.",
"code": 200,
"data": {
"next_page": null,
"pages": 1,
"prev_page": null,
"nearby_user_locations": [
{
"id": "5e859a87a15ceb1f5abd25a8",
"app_id": "5e85988fa15ceb1f59bd1b9e_2",
"coordinates": {
"type": "Point",
"coordinates": [
77.623,
12.9010648962431
]
},
"activity": "WALK",
"accuracy": 65.0,
"timezone_offset": "+0200",
"net_stat": true,
"gps_stat": true,
"motion_stat": true,
"app_stat": "BACKGROUND",
"battery_remaining": 50,
"bat_stat": "Unplugged",
"created_at": "2020-04-02T07:55:55.024",
"device_token": "devicetokenjsdfuyafsdu"
},
{
"id": "5e8598bda15ceb1f5abd25a1",
"app_id": "5e85988fa15ceb1f59bd1b9e_2",
"coordinates": {
"type": "Point",
"coordinates": [
77.623,
12.9010648962431
]
},
"activity": "WALK",
"accuracy": 65.0,
"timezone_offset": "+0200",
"net_stat": true,
"gps_stat": true,
"motion_stat": true,
"app_stat": "BACKGROUND",
"battery_remaining": 50,
"bat_stat": "Unplugged",
"created_at": "2020-04-02T07:48:17.150"
},
{
"id": "5e85989d14d2310740c41645",
"app_id": "5e85988fa15ceb1f59bd1b9e_2",
"coordinates": {
"type": "Point",
"coordinates": [
77.635536,
12.914478
]
},
"activity": "STOP",
"accuracy": 65.0,
"timezone_offset": "+0200",
"started_at": "2020-04-02T07:47:54.711",
"ended_at": "2020-04-02T07:47:54.711",
"net_stat": true,
"gps_stat": true,
"motion_stat": true,
"app_stat": "BACKGROUND",
"battery_remaining": 3,
"bat_stat": "Charging",
"created_at": "2020-04-02T07:47:54.869",
"device_token": "devicetoken"
}
]
}
}

Sample Call

cURL
JavaScript
Python
Java
Swift
Go
cURL
curl --location --request POST 'https://api.geospark.co/v1/api/user/nearby/' \
--header 'Api-Key: a75f0408ea944ec78a4b0fdb92ac34c4' \
--header 'Content-Type: application/json' \
--data-raw '{
"radius": 3000,
"geometry": {
"type": "Point",
"coordinates": [77.65195, 12.91655]
}
}'
JavaScript
var settings = {
"url": "https://api.geospark.co/v1/api/user/nearby/",
"method": "POST",
"timeout": 0,
"headers": {
"Api-Key": "a75f0408ea944ec78a4b0fdb92ac34c4",
"Content-Type": "application/json"
},
"data": JSON.stringify({"radius":3000,"geometry":{"type":"Point","coordinates":[77.65195,12.91655]}}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Python
import requests
url = "https://api.geospark.co/v1/api/user/nearby/"
payload = "{\n\t\"radius\": 3000,\n\t\"geometry\": {\n\t\t\"type\": \"Point\",\n\t\t\"coordinates\": [77.65195, 12.91655]\n\t}\n\t\n}"
headers = {
'Api-Key': 'a75f0408ea944ec78a4b0fdb92ac34c4',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
Java
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"radius\": 3000,\n\t\"geometry\": {\n\t\t\"type\": \"Point\",\n\t\t\"coordinates\": [77.65195, 12.91655]\n\t}\n\t\n}");
Request request = new Request.Builder()
.url("https://api.geospark.co/v1/api/user/nearby/")
.method("POST", body)
.addHeader("Api-Key", "a75f0408ea944ec78a4b0fdb92ac34c4")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
Swift
import Foundation
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\n\t\"radius\": 3000,\n\t\"geometry\": {\n\t\t\"type\": \"Point\",\n\t\t\"coordinates\": [77.65195, 12.91655]\n\t}\n\t\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.geospark.co/v1/api/user/nearby/")!,timeoutInterval: Double.infinity)
request.addValue("a75f0408ea944ec78a4b0fdb92ac34c4", forHTTPHeaderField: "Api-Key")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
Go
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.geospark.co/v1/api/user/nearby/"
method := "POST"
payload := strings.NewReader("{\n \"radius\": 3000,\n \"geometry\": {\n \"type\": \"Point\",\n \"coordinates\": [77.65195, 12.91655]\n }\n \n}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Api-Key", "a75f0408ea944ec78a4b0fdb92ac34c4")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}

post
Get User Insights API

https://api.geospark.co/v1/api/insights/
This API will provide the list of insights with boundary coordinates of the location, last visited detail, type and confidence for each.
Request
Response
Request
Headers
Content-Type
required
string
application/json
Api-Key
required
string
33223kjhdcscijhb5sdbsdmjsdcbj5f
Body Parameters
user_id
optional
string
user_id to find the users around
Response
200: OK
JSON
{
"status": true,
"msg": "Success.",
"code": 201,
"data": [
{
"user_id": "5eb94798fc0bfe6584414ec0",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
76.91802960000003,
15.15829215322974
],
[
76.9182311463149,
15.158261341987622
],
[
76.91841296371013,
15.158171924305728
],
[
76.91855725453212,
15.158032653076313
],
[
76.91864989458988,
15.157857161219924
],
[
76.91868181572923,
15.157662627168717
],
[
76.9186498934488,
15.157468093296442
],
[
76.91855725268583,
15.157292601908491
],
[
76.91841296186385,
15.1571533312581
],
[
76.91823114517382,
15.157063914044647
],
[
76.91802960000003,
15.157033102981456
],
[
76.91782805482622,
15.157063914044647
],
[
76.91764623813619,
15.1571533312581
],
[
76.91750194731421,
15.157292601908491
],
[
76.91740930655124,
15.157468093296442
],
[
76.9173773842708,
15.157662627168717
],
[
76.91740930541016,
15.157857161219924
],
[
76.91750194546792,
15.158032653076313
],
[
76.91764623628991,
15.158171924305728
],
[
76.91782805368514,
15.158261341987622
]
]
]
},
"is_poi": false,
"last_visited_on": "2020-05-22T16:07:59.001",
"timezone_offset": "+0530",
"confidence": "Medium",
"dataset": {
"start_time": "2020-04-14T05:20:39.176885",
"end_time": "2020-05-26T05:20:39.176885",
"is_weekend": true
},
"location_significance": {
"is_home": true,
"is_work": false,
"number_of_visits": 7
},
"location_place": {
"geometry": {
"type": "Point",
"coordinates": [
76.91802960000001,
15.157662628105598
]
},
"type": "city",
"name": "Ballari"
},
"created_at": "2020-05-26T05:20:45.388",
"app_id": "5bf3f5d7dd938814bce3545e_1",
"id": "5ecca735609ea47b89d3d8d3"
},
{
"user_id": "5eb94798fc0bfe6584414ec0",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
77.636846,
12.914286525124147
],
[
77.63704558227211,
12.914255713895772
],
[
77.637225627905,
12.914166296249864
],
[
77.63736851269373,
12.91402702506493
],
[
77.63746025007966,
12.913851533244525
],
[
77.63749186025221,
12.913656999207062
],
[
77.6374602491233,
12.913462465321038
],
[
77.63736851114632,
12.913286973897105
],
[
77.6372256263576,
12.913147703202235
],
[
77.63704558131576,
12.913058285952799
],
[
77.636846,
12.913027474875864
],
[
77.63664641868425,
12.913058285952799
],
[
77.6364663736424,
12.913147703202235
],
[
77.63632348885368,
12.913286973897105
],
[
77.63623175087672,
12.913462465321038
],
[
77.6362001397478,
12.913656999207062
],
[
77.63623174992036,
12.913851533244525
],
[
77.63632348730627,
12.91402702506493
],
[
77.636466372095,
12.914166296249864
],
[
77.63664641772789,
12.914255713895772
]
]
]
},
"is_poi": false,
"last_visited_on": "2020-05-15T15:52:53.637",
"timezone_offset": "+0530",
"confidence": "Medium",
"dataset": {
"start_time": "2020-04-14T05:20:39.176885",
"end_time": "2020-05-26T05:20:39.176885",
"is_weekend": true
},
"location_significance": {
"is_home": false,
"is_work": true,
"number_of_visits": 5
},
"location_place": {
"geometry": {
"type": "Point",
"coordinates": [
77.636846,
12.913657000000006
]
},
"type": "amenity",
"name": "Apollo Clinic"
},
"created_at": "2020-05-26T05:20:45.894",
"app_id": "5bf3f5d7dd938814bce3545e_1",
"id": "5ecca735609ea47b89d3d8d4"
},
{
"user_id": "5eb94798fc0bfe6584414ec0",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
76.91378795461243,
15.156527562632935
],
[
76.91398949924582,
15.15649675139083
],
[
76.91417131512415,
15.15640733370896
],
[
76.91431560474238,
15.156268062479587
],
[
76.91440824402731,
15.156092570623224
],
[
76.91444016490047,
15.155898036572028
],
[
76.91440824288641,
15.155703502699737
],
[
76.91431560289634,
15.15552801131176
],
[
76.91417131327813,
15.155388740661339
],
[
76.9139894981049,
15.155299323447853
],
[
76.91378795461243,
15.155268512384652
],
[
76.91358641111997,
15.155299323447853
],
[
76.91340459594674,
15.155388740661339
],
[
76.91326030632852,
15.15552801131176
],
[
76.91316766633847,
15.155703502699737
],
[
76.9131357443244,
15.155898036572028
],
[
76.91316766519755,
15.156092570623224
],
[
76.91326030448248,
15.156268062479587
],
[
76.91340459410071,
15.15640733370896
],
[
76.91358640997905,
15.15649675139083
]
]
]
},
"is_poi": true,
"last_visited_on": "2020-05-25T15:45:45.645",
"timezone_offset": "+0530",
"confidence": "Medium",
"dataset": {
"start_time": "2020-04-14T05:20:39.176885",
"end_time": "2020-05-26T05:20:39.176885",
"is_weekend": true
},
"location_significance": {
"is_home": false,
"is_work": false,
"number_of_visits": 4
},
"location_place": {
"geometry": {
"type": "Point",
"coordinates": [
76.91378795461243,
15.155898037508797
]
},
"type": "city",
"name": "Ballari"
},
"created_at": "2020-05-26T05:20:46.391",
"app_id": "5bf3f5d7dd938814bce3545e_1",
"id": "5ecca735609ea47b89d3d8d5"
},
{
"user_id": "5eb94798fc0bfe6584414ec0",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
76.887238644259,
15.161517684393285
],
[
76.88744019364809,
15.161486873151143
],
[