Home


Emplacement API V2

Index

Routes
/Token/get
Description

Gets a new User Token to be used for Unique Authentication and will be REQUIRED to get locations

Type

GET

URL

www.emplacementapi.com/v2/api/Token/get?Key=[API_KEY]

Requirements

ParameterDescription
KeyAn API Key is REQUIRED to get a User Token

/Locations/get
Description

Gets locations within a radius of the given Search Point

Type

GET

URL

www.emplacementapi.com/v2/api/Locations/get?Token=[USER_TOKEN]&latitude=[LATITUDE]longitude=[LONGITUDE]

Requirements

ParameterDescription
TokenA Token is REQUIRED to make Location requests
Search PointEither Latitude,Longitude OR a Zip Code is REQUIRED to make Location requests
((Latitude / lat) AND (Longitude / lng)) OR Zip

Parameters

ParameterDescription
TokenA Token is used to authenticate user

(?/&)Token=[USER_TOKEN]
ZipDefines search area's zip code

(?/&)Zip=[ZIP_CODE]
LatitudeDefines search area's Latitude coordinate

(?/&)(Latitude / lat)=[LATITUDE]
LongitudeDefines search area's Longitude coordinate

(?/&)(Longitude / Lng)=[LONGITUDE]
RadiusDefines how large of an area to search

(?/&)Radius=[RADIUS]

Default: 5
Minimum: 5
Maximum: 50
/Locations/report
Description

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.

Type

POST

URL

www.emplacementapi.com/v2/api/locations/report?Token=[USER_TOKEN]&id=[LOCATION_ID]

Requirements

ParameterDescription
TokenA Token is REQUIRED to report a location
IDA Location ID is REQUIRED to report a location


Authentication Diagram

Examples
Get User Token
Description

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

URL

www.emplacementapi.com/v2/api/Token/get?Key=[API_KEY]

CURL
curl "www.emplacementapi.com/v2/api/token/get?key=123"
Node JS
const request = require('request');

request.get("www.emplacementapi.com/v2/api/token/get?key=123", function (error, response, body) {
    console.log(body);
});
Returns

Unique User Token to identify each device


{
	"status": true,
	"message": "Successfully retrieved token",
	"token": "v2.local.IlO7w-AwfJlNhzThnNRPdunw3arEGncRm2WicPAKSsvljxWhaC1O7rSF9UCGh7FahM6FqkHcRGBJcV0r-L3_eF1iUf21AN6wir7Gzd-M2UmvMfy5RA"
}
Get Location Within 20 Miles of a GPS Coordinate
Description

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

URL

www.emplacementapi.com/v2/api/Locations/get?Token=[USER_TOKEN]&latitude=33.11&longitude=-117.16&radius=20

CURL
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"
Node JS
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);
});
Returns

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 truncated

Get Location Within 5 Miles of Zip code
Description

Demonstrates how a users Zip Code could be used to find location

This example demonstrates how all parameters are passed in the headers

URL

www.emplacementapi.com/v2/api/Locations/get?Token=[USER_TOKEN]&zip=[ZIP_CODE]

CURL
curl "www.emplacementapi.com/v2/api/locations/get" \
--header "token: v2.local.IlO7w-AwfJlNhzThnNRPdunw3arEGncRm2WicPAKSsvljxWhaC1O7rSF9UCGh7FahM6FqkHcRGBJcV0r-L3_eF1iUf21AN6wir7Gzd-M2UmvMfy5RA" \
--header "zip: 92024"
Node JS
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);
});
Returns

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 truncated

Report that a location has been closed
Description

Demonstrates 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

URL

www.emplacementapi.com/v2/api/Locations/report?Token=[USER_TOKEN]&id=[LOCATION_ID]

CURL
curl -X POST "www.emplacementapi.com/v2/api/locations/report" \
--header "token: v2.local.IlO7w-AwfJlNhzThnNRPdunw3arEGncRm2WicPAKSsvljxWhaC1O7rSF9UCGh7FahM6FqkHcRGBJcV0r-L3_eF1iUf21AN6wir7Gzd-M2UmvMfy5RA" \
--header "id: 1"
Node JS
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);
});
Returns

Confirmation that the location has successfully been reported as closed

{
    "status": true,
    "message": "Location 1 has been reported"
}


Data Types
Parameters
VariableType
KeyString
TokenString
ZipInteger
LatitudeDouble Precision
LongitudeDouble Precision
RadiusInteger
ZipInteger
IDInteger
Responses
{
    "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"
        }
	]
}