API
INTRODUCTION
You can access all of your NearX data, including users, events, geofences, and groups, via the API. You might use the API to list users in a specific geofence, or to create geofences programmatically.
The API is RESTful, with predictable, resource-oriented URLs. All responses, including errors, return json. POST and PUT request body parameters may be sent as application/json or application/x-www-form-urlencoded.
AUTHENTICATION
All requests must be authenticated. Authenticate using your secret API keys, found on the Settings page. Use your Test Secret key for testing and non-production environments. Use your Live Secret key for production environments. Include your API key in the Authorization header. Sample request
-
curl https://dev-api.getwalk.in/nearx/api/geofences \ -H "token: prj_live_sk_108c97506e7549bdbffd68cc4512a7df1fc1c469"
ERRORS
The GraphQL uses standard HTTP response codes. Response codes
200:
Success400:
Bad request (missing mandatory field or invalid params)403:
Unauthorized (insufficient permissions)404:
Not found500:
Internal server error503:
Service temporarily unavailable
-
{ "errors": [ { "err": { "errorCode": 403, "httpStatus": "Unauthorized" }, "message": "Auth token is invalid" } }
DESCRIPTION
GEOFENCE
GET | /nearx/api/list-geofences?limit={Int}&offset={Int}
Lists geofences created for an org
|
GET | /nearx/api/get-geofences?{id}
Fetches specific geofence details uniquely identified by the ID
|
POST | /nearx/api/create-geofence/
Creates a new geofence for your organization with lat,lng & radii.
|
POST | /nearx/api/update-geofence/{id}
Updates a unique geofence with given Id. If geofence with specific id doesn't exists, it throws error.
|
POST | /nearx/api/disable-geofence/{id}
Inactivates a geofence of a particular organization
|
GROUP
GET | /nearx/api/list-places?limit={Int}&offset={Int}
Lists groups created for an org
|
GET | /nearx/api/get-group?{id}
Fetches specific group details uniquely identified by the ID
|
POST | /nearx/api/create-group/
Creates a new group for your organization with a groupName
|
POST | /nearx/api/update-group/{id}
Updates a unique group with given Id. If group with specific id doesn't exists, it throws error.
|
POST | /nearx/api/disable-group/{id}
Inactivates a group of a particular organization
|
PLACE
GET | /nearx/api/list-places?limit={Int}&offset={Int}
Lists places created for an org
|
GET | /nearx/api/get-place?{id}
Fetches specific place details uniquely identified by the ID
|
POST | /nearx/api/create-or-update-place/
Creates a new place for your organization. You can create it with or without hotspot
|
ENDPOINTS
LIST GEOFENCES
Lists geofences specific to your organization
QUERY PARAMS
limit (number, optional):
Retrieves a specific number of geofences. A number between 1 and 1000. Defaults to 10.offset (number, optional):
Retrieves a specific geofences from offset number. Defaults to 0.
-
curl 'https://dev-api.getwalk.in/nearx/api/geofences?limit={Int}&offset={Int}' -H 'Content-Type: application/json' \ -H 'token: <<SampleToken>>'
-
{ "id": "4", "geofenceName": "Silk Board Bus Stop", "location": { "lat": 12.9308829, "lng": 77.6238343 }, "radii": [ 1000 ], "area": "Silk Board", "city": "Bangalore", "state": "Karnataka", "country": "India", "address": "Silk board bus stand, koramangala", "appId": "2fasfs-da3f-4d7e-3fsd6d-df2342dfsfsc", "orgId": "1f8d8200-f0d7-4d7e-b36d-573c9e6c578c", "enabled": true, "groups": [1] }
GET GEOFENCE
Fetches geofence details unique to an ID.
QUERY PARAMS
-
ID (ID, required):
Unique Id of the geofence -
curl 'https://dev-api.getwalk.in/nearx/api/get-geofence/{id}?=' \ -H 'Content-Type: application/json' \ -H 'token: <<SampleToken>>'
-
{ "id": "4", "geofenceName": "Silk Board Bus Stop", "location": { "lat": 12.9308829, "lng": 77.6238343 }, "radii": [ 1000 ], "area": "Silk Board", "city": "Bangalore", "state": "Karnataka", "country": "India", "address": "Silk board bus stand, koramangala", "appId": "2fasfs-da3f-4d7e-3fsd6d-df2342dfsfsc", "orgId": "1f8d8200-f0d7-4d7e-b36d-573c9e6c578c", "enabled": true, "groups": [1] }
CREATE GEOFENCE
Creates a new geofence. If there is a geofence with the specified tag and externalId already exists, the request will fail. If no radii is given, by default it is set to 200.
QUERY PARAMS
geofenceName (string, required):
Name of the geofencelocation (json, required):
json string representing a center in the format {longitude,latitude} for type circleradius (number, required for type circle):
The radius of the circle in meters for type circle, a number between 50 and 10000. Ignored for type polygon.address (string, required):
Add the address for the geofence(including area,city,state,country)
-
curl -i -X 'https://dev-api.getwalk.in/nearx/api/create-geofence/' \ -H 'Content-Type: application/json' \ -H 'token: <<SampleToken>>' -D '{ "geofenceInput":{ "geofenceName":"CCD", "location":{ "lat": 12.9131684 "lng": 77.6498837 } "radii":100, "address":"CCD in HSR", "area": "HSR", "city": "Bangalore", "state":"KA", "country":"India" } }'
-
{ "id": "4", "geofenceName": "CCD", "location": { "lat": 12.9131684, "lng": 77.6498837 }, "radii": [ 1000 ], "area": "HSR", "city": "Bangalore", "state": "Karnataka", "country": "India", "address": "CCD in HSR", "appId": "2fasfs-da3f-4d7e-3fsd6d-df2342dfsfsc", "orgId": "1f8d8200-f0d7-4d7e-b36d-573c9e6c578c", "enabled": true, }
UPDATE GEOFENCE
Updates a unique geofence with given Id. If geofence with specific id doesn't exists, it throws error.
QUERY PARAMS
GeofenceInput (json, required)
: Contains fields that you would want to updateid (ID, required)
: Identifies the uniquely a geofence
-
curl 'https://dev-api.getwalk.in/nearx/api/update-geofence/{id}?=' \ -H 'Content-Type: application/json' \ -H 'token: <<SampleToken>>' -D '{ "id":4, "geofenceInput":{ "geofenceName":"Silk Board" } }'
-
{ "id": "4", "geofenceName": "Silk Board", "location": { "lat": 12.9308829, "lng": 77.6238343 }, "radii": [ 1000 ], "area": "Silk Board", "city": "Bangalore", "state": "Karnataka", "country": "India", "address": "Silk board bus stand, koramangala", "appId": "2fasfs-da3f-4d7e-3fsd6d-df2342dfsfsc", "orgId": "1f8d8200-f0d7-4d7e-b36d-573c9e6c578c", "enabled": true, "groups": [1] "enabled": true }
DISABLE GEOFENCE
Disables a geofence. The geofence can be uniquely referenced by geofence id.
QUERY PARAMS
ID (ID, required)
: Unique Id of the geofence
-
curl 'https://dev-api.getwalk.in/nearx/api/disable-geofence/{id}' \ -H 'Content-Type: application/json' \ -H 'token: <<SampleToken>>'
-
{ "id": "4", "geofenceName": "Silk Board", "location": { "lat": 12.9308829, "lng": 77.6238343 }, "radii": [ 1000 ], "area": "Silk Board", "city": "Bangalore", "state": "Karnataka", "country": "India", "address": "Silk board bus stand, koramangala", "appId": "2fasfs-da3f-4d7e-3fsd6d-df2342dfsfsc", "orgId": "1f8d8200-f0d7-4d7e-b36d-573c9e6c578c", "enabled": false, "groups": [1] }
GET GROUP
Fetches particular groups' details
QUERY PARAMS
-
ID (ID!)
: Identifies uniquely a group. -
curl 'https://dev-api.getwalk.in/nearx/api/get-group/{id}' \ -H 'Content-Type: application/json' \ -H 'token: <<SampleToken>>'
-
{ "id": "345", "groupName": "HighPriced", "orgId": "1f8d8200-f0d7-4d7e-b36d-573c9e6c578c", "enabled": true }
LIST GROUP
List groups. Geofences are sorted descending by createdTime.
QUERY PARAMS
limit (number, optional)
: Retrieves a specific number of groups. A number between 1 and 1000. Defaults to 10.offset (number, optional)
: Retrieves a specific geofences from offset number. Defaults to 0.
-
curl 'https://dev-api.getwalk.in/nearx/api/list-groups/' \ -H 'Content-Type: application/json' \ -H 'token: <<SampleToken>>'
-
{ "groups": [ { "id": "348", "enabled": true, "groupName": "ccd in hsr" } ] } }
CREATE GROUP
Creates a new group with group information.
QUERY PARAMS
groupName (String!)
: Specifies name of the groupmetaData (json, optional)
: Any extra details for the group can be added here. For example, store ID.
-
curl 'https://dev-api.getwalk.in/nearx/api/create-group/' \ -H 'Content-Type: application/json' \ -H 'token: <<SampleToken>>' -D '{ "groupInput":{ "groupName":"CCD in Koramangala" } }'
-
{ "createGroup": { "id": "350", "enabled": true } }
UPDATE GROUP
Updates an existing group with group information
QUERY PARAMS
ID (ID!)
: Identifies uniquely a group.GroupInput (json!)
: Any update to the group can be done with the fields listed here.
-
curl 'https://dev-api.getwalk.in/nearx/api/update-group/{id}' \ -H 'Content-Type: application/json' \ -H 'token: <<SampleToken>>' -D '{ "groupInput":{ "groupName":"CCD in Koramangala 3rd block" } }'
-
{ "updateGroup": { "id": "350", "groupName": "CCD in Koramangala 3rd block", "enabled":true } }
DISABLE GROUP
Disables an existing group
QUERY PARAMS
-
ID (ID!)
: Identifies uniquely a group. -
curl 'https://dev-api.getwalk.in/nearx/api/disable-group/{id}' \ -H 'Content-Type: application/json' \ -H 'token: <<SampleToken>>'
-
{ "disableGroup": { "id": "350", "groupName": "CCD in Koramangala 3rd block", "enabled": false } }
LIST PLACES
Lists a specific places' details with hotspots.
QUERY PARAMS
limit (number, optional)
: Retrieves a specific number of places. A number between 1 and 1000. Defaults to 10.offset (number, optional)
: Retrieves a specific places from offset number. Defaults to 0.
-
curl 'https://dev-api.getwalk.in/nearx/api/disable-group/?limit={limit}&offset={offset}' \ -H 'Content-Type: application/json' \ -H 'token: <<SampleToken>>'
-
{ "places": [ { "id": "1598", "geofenceName": "Little Elly School", "location": { "lat": 12.9314279, "lng": 77.6250023 }, "address":"Koramangala 3rd block", "area":"Koramangala", "city":"Bangalore", "state":"KA", "country":"India", "appId": "2fasfs-da3f-4d7e-3fsd6d-df2342dfsfsc", "orgId": "1f8d8200-f0d7-4d7e-b36d-573c9e6c578c", "totalHotspot": 0, "hotspots": [], } }, { "id": "1597", "geofenceName": "BBMP Park", "location": { "lat": 12.9314279, "lng": 77.6250023 }, "address":"Koramangala 3rd block", "area":"Koramangala", "city":"Bangalore", "state":"KA", "country":"India", "appId": "2fasfs-da3f-4d7e-3fsd6d-df2342dfsfsc", "orgId": "1f8d8200-f0d7-4d7e-b36d-573c9e6c578c", "totalHotspot": 1, "hotspots": [ { "id": "1598", "geofenceName": "Little Elly School" } ] } ], "pageInfo": { "current": 0, "last": 5, "pageSize": 2, "from": 0, "to": 2, "total": 11 } }
GET PLACE
Gets a particular place details specific to an ID.
QUERY PARAMS
-
ID (ID)
: Uniquely identifies a place -
curl 'https://dev-api.getwalk.in/nearx/api/get-place/{id}' \ -H 'Content-Type: application/json' \ -H 'token: <<SampleToken>>'
-
{ "place": { "id": "1597", "geofenceName": "BBMP Park", "location": { "lat": 12.9314279, "lng": 77.6250023 } "address":"Koramangala 3rd block", "area":"Koramangala", "city":"Bangalore", "state":"KA", "country":"India", "appId": "2fasfs-da3f-4d7e-3fsd6d-df2342dfsfsc", "orgId": "1f8d8200-f0d7-4d7e-b36d-573c9e6c578c", "totalHotspot": 1, "hotspots": [ { "id": "1598", "geofenceName": "Little Elly School" } ] } }
CREATE OR UPDATE PLACE
Creates or Updates an existing place. This supports both adding and removing hotspots to an existing place.
QUERY PARAMS
geofenceName (string, required)
: A name for the place.location (json, required)
: json string representing a center in the format {longitude,latitude} for type circle.radius (number, required for type circle)
: The radius of the circle in meters for type circle, a number between 50 and 10000. Ignored for type polygon.address (string, required)
: Add the address for the geofence(area, city, state,country).mainPlace(Boolean)
: Distinguishes between a place and a hotspot
-
curl 'https://dev-api.getwalk.in/nearx/api/create-or-update-place/' \ -H 'Content-Type: application/json' \ -H 'token: <<SampleToken>>' -D '{ "placeInput:"[ { "geofenceName":"BBMP Park", "location":{ "lat":12.9314279 "lng":77.6250023 } "radii":50, "address":"BBMP Park, Koramangala, Bangalore", "area":"Koramangala", "city":"Bangalore", "state":"KA", "country": "India", "mainPlace":true }, { "geofenceName":"Little Elly School", "location":{ "lat":12.9243543 "lng":77.6234023 } "radii":50, "address":"BBMP Park, Koramangala, Bangalore", "area":"Koramangala", "city":"Bangalore", "state":"KA", "country": "India" } ] }'
-
{ "createOrUpdatePlace": { "id": "1597", "geofenceName": "BBMP Park", "radii":50, "address":"BBMP Park, Koramangala, Bangalore", "area":"Koramangala", "city":"Bangalore", "state":"KA", "country": "India", "enabled":true, "appId": "2fasfs-da3f-4d7e-3fsd6d-df2342dfsfsc", "orgId": "1f8d8200-f0d7-4d7e-b36d-573c9e6c578c", "hotspots": [ { "id": "1598", "geofenceName": "Little Elly School", "location":{ "lat":12.9243543 "lng":77.6234023 } "radii":50, "address":"BBMP Park, Koramangala, Bangalore", "area":"Koramangala" "city":"Bangalore" "state":"KA" "country": "India" "appId": "2fasfs-da3f-4d7e-3fsd6d-df2342dfsfsc", "orgId": "1f8d8200-f0d7-4d7e-b36d-573c9e6c578c", "enabled":true } ], "totalHotspot": 1 } } }
Support
Have questions after reading the documentation? Contact us here