Gets a new User Token to be used for Unique Authentication and will be REQUIRED to get locations
GET
www.emplacementapi.com/v2/api/Token/get?Key=[API_KEY]
Parameter | Description |
---|---|
Key | An API Key is REQUIRED to get a User Token |
Gets locations within a radius of the given Search Point
GET
www.emplacementapi.com/v2/api/Locations/get?Token=[USER_TOKEN]&latitude=[LATITUDE]longitude=[LONGITUDE]
Parameter | Description |
---|---|
Token | A Token is REQUIRED to make Location requests |
Search Point | Either Latitude,Longitude OR a Zip Code is REQUIRED to make Location requests ((Latitude / lat) AND (Longitude / lng)) OR Zip |
Parameter | Description |
---|---|
Token | A Token is used to authenticate user (?/&)Token=[USER_TOKEN] |
Zip | Defines search area's zip code (?/&)Zip=[ZIP_CODE] |
Latitude | Defines search area's Latitude coordinate (?/&)(Latitude / lat)=[LATITUDE] |
Longitude | Defines search area's Longitude coordinate (?/&)(Longitude / Lng)=[LONGITUDE] |
Radius | Defines how large of an area to search (?/&)Radius=[RADIUS] Default: 5 Minimum: 5 Maximum: 50 |
Reports that a location has been closed
User reports will be sent back with location data, and if confirmed as permanently closed removed from he list.
POST
www.emplacementapi.com/v2/api/locations/report?Token=[USER_TOKEN]&id=[LOCATION_ID]
Parameter | Description |
---|---|
Token | A Token is REQUIRED to report a location |
ID | A Location ID is REQUIRED to report a location |
This is the first call that is required to identify the device, save this Token to be used for End User Authentication
This example demonstrates sending parameters in the URL
www.emplacementapi.com/v2/api/Token/get?Key=[API_KEY]
curl "www.emplacementapi.com/v2/api/token/get?key=123"
const request = require('request');
request.get("www.emplacementapi.com/v2/api/token/get?key=123", function (error, response, body) {
console.log(body);
});
Unique User Token to identify each device
{
"status": true,
"message": "Successfully retrieved token",
"token": "v2.local.IlO7w-AwfJlNhzThnNRPdunw3arEGncRm2WicPAKSsvljxWhaC1O7rSF9UCGh7FahM6FqkHcRGBJcV0r-L3_eF1iUf21AN6wir7Gzd-M2UmvMfy5RA"
}
Demonstrates how a users GPS coordinates could be used to find locations within a certain radius
Parameters can be sent in the URL or in the Headers like in this example where both are used
www.emplacementapi.com/v2/api/Locations/get?Token=[USER_TOKEN]&latitude=33.11&longitude=-117.16&radius=20
curl "www.emplacementapi.com/v2/api/locations/get?latitude=33.11&longitude=-117.16&radius=20" \
--header "token: v2.local.IlO7w-AwfJlNhzThnNRPdunw3arEGncRm2WicPAKSsvljxWhaC1O7rSF9UCGh7FahM6FqkHcRGBJcV0r-L3_eF1iUf21AN6wir7Gzd-M2UmvMfy5RA"
const request = require('request');
var options = {
url: "www.emplacementapi.com/v2/api/locations/get?latitude=33.11&longitude=-117.16&radius=20",
headers: {
'token': 'v2.local.IlO7w-AwfJlNhzThnNRPdunw3arEGncRm2WicPAKSsvljxWhaC1O7rSF9UCGh7FahM6FqkHcRGBJcV0r-L3_eF1iUf21AN6wir7Gzd-M2UmvMfy5RA'
}
};
request.get(options, function (error, response, body) {
console.log(body);
});
Locations within 20 Miles of coordinates 33.11,-117.16 sorted by distance
for more details on the DataTypes of the returned locations please see DataTypes
{
"status": true,
"message": "retrieved from locations",
"filters": {
"search_latitude": 33.11,
"search_longitude": -117.16,
"search_zip": null,
"radius": 20
},
"results": 42,
"data": [
{
"distance": "1.66",
"id": 1025,
"name": "Location 1025",
"street_address": "Demo",
"city": "San Marcos",
"state": "CA",
"zip_code": "92078",
"county": "San Diego County",
"country": "United States",
"latitude": 33.13193,
"longitude": -117.17156,
"phone_number": "Demo",
"last_verified_date": "2018-07-02T07:00:00.000Z",
"closed_reports": "0"
},
{
"distance": "1.91",
"id": 1026,
"name": "Location 1026",
"street_address": "Demo",
"city": "San Marcos",
"state": "CA",
"zip_code": "92078",
"county": "San Diego County",
"country": "United States",
"latitude": 33.13129,
"longitude": -117.1811,
"phone_number": "Demo",
"last_verified_date": "2018-07-02T07:00:00.000Z",
"closed_reports": "0"
}
]
}
results have been truncatedDemonstrates how a users Zip Code could be used to find location
This example demonstrates how all parameters are passed in the headers
www.emplacementapi.com/v2/api/Locations/get?Token=[USER_TOKEN]&zip=[ZIP_CODE]
curl "www.emplacementapi.com/v2/api/locations/get" \
--header "token: v2.local.IlO7w-AwfJlNhzThnNRPdunw3arEGncRm2WicPAKSsvljxWhaC1O7rSF9UCGh7FahM6FqkHcRGBJcV0r-L3_eF1iUf21AN6wir7Gzd-M2UmvMfy5RA" \
--header "zip: 92024"
const request = require('request');
var options = {
url: "www.emplacementapi.com/v2/api/locations/get",
headers: {
'token': 'v2.local.IlO7w-AwfJlNhzThnNRPdunw3arEGncRm2WicPAKSsvljxWhaC1O7rSF9UCGh7FahM6FqkHcRGBJcV0r-L3_eF1iUf21AN6wir7Gzd-M2UmvMfy5RA',
'zip': 92024
}
};
request.get(options, function (error, response, body) {
console.log(body);
});
Locations within 5 Miles of [ZIP_CODE], with the default Radius value
{
"status": true,
"message": "retrieved from locations",
"filters": {
"search_latitude": 33.05,
"search_longitude": -117.25,
"search_zip": 92024,
"radius": 5
},
"results": 3,
"data": [
{
"distance": "0.63",
"id": 4583,
"name": "Location 4583",
"street_address": "Demo",
"city": "Encinitas",
"state": "CA",
"zip_code": "92024",
"county": "San Diego County",
"country": "United States",
"latitude": 33.04106,
"longitude": -117.25167,
"phone_number": "Demo",
"last_verified_date": "2018-07-03T07:00:00.000Z",
"closed_reports": "0"
},
{
"distance": "1.05",
"id": 1027,
"name": "Location 1027",
"street_address": "Demo",
"city": "Encinitas",
"state": "CA",
"zip_code": "92024",
"county": "San Diego County",
"country": "United States",
"latitude": 33.06152,
"longitude": -117.26186,
"phone_number": "Demo",
"last_verified_date": "2018-07-02T07:00:00.000Z",
"closed_reports": "0"
}
]
}
results have been truncatedDemonstrates how a users can report that a location is no longer in service
These reports will be included in location results, then they will be reviewed and if validated removed from the database
www.emplacementapi.com/v2/api/Locations/report?Token=[USER_TOKEN]&id=[LOCATION_ID]
curl -X POST "www.emplacementapi.com/v2/api/locations/report" \
--header "token: v2.local.IlO7w-AwfJlNhzThnNRPdunw3arEGncRm2WicPAKSsvljxWhaC1O7rSF9UCGh7FahM6FqkHcRGBJcV0r-L3_eF1iUf21AN6wir7Gzd-M2UmvMfy5RA" \
--header "id: 1"
const request = require('request');
var options = {
url: "www.emplacementapi.com/v2/api/locations/report",
headers: {
'token': 'v2.local.IlO7w-AwfJlNhzThnNRPdunw3arEGncRm2WicPAKSsvljxWhaC1O7rSF9UCGh7FahM6FqkHcRGBJcV0r-L3_eF1iUf21AN6wir7Gzd-M2UmvMfy5RA',
'id': 1
}
};
request.post(options, function (error, response, body) {
console.log(body);
});
Confirmation that the location has successfully been reported as closed
{
"status": true,
"message": "Location 1 has been reported"
}
Variable | Type |
---|---|
Key | String |
Token | String |
Zip | Integer |
Latitude | Double Precision |
Longitude | Double Precision |
Radius | Integer |
Zip | Integer |
ID | Integer |
{
"status": "Boolean",
"message": "String",
"filters": "JSON" {
"search_latitude": "Double Precision",
"search_longitude": "Double Precision",
"search_zip": "Integer",
"radius": "Integer"
},
"results": "Integer",
"data": "JSON" [
{
"distance": "Double",
"id": "Integer",
"name": "String",
"street_address": "String",
"city": "String",
"state": "String",
"zip_code": "Integer",
"county": "String",
"country": "String",
"latitude": "Double Precision",
"longitude": "Double Precision",
"phone_number": "String",
"last_verified_date": "Date",
"closed_reports": "Integer"
}
]
}