Location Id API
Location id API offers a simple way to tag a given location (lat,long / address) with a grid id. The grids are managed by the system for a given configuration and offer a way to group a set of assets, events and other things with in a geographical location. This information can then be used for Insurance rate calculations, Logistical planning, Risk management etc.
Typical User Journey
journey
title How to use Grid Location Id Feature
section Configure grids
Pick a state: 3: Onetime
Pick grid size: 3: Onetime
Save config: 5: Onetime
section API Calls
Send lat,long: 3: New Asset / Location
Get Location Id: 5: New Asset / Location
Store Id: 3: New Asset / Location
Getting the grid id using coordinates (latitude & longitude)
To get the location id of a given location using the standard coordinates(WGS84 projection) [latitude, longitude], the following call can be used.
GET /grid/locate/coordinates ?
config_id=<grid_id> &
latitude=<lat> &
longitude=-<long>
The above API call will return something like the following if the location is found within the area represented by the configuration specified.
{
"success": {
"total": 2
},
"contents": {
"inputs": {
"type": "coordinates",
"latitude": "33.077610",
"longitude": "-96.547060"
},
"result": {
"id": "INTE-4085220",
"url": "https://grids.one/a/grid/gridcfg_t5696YnzMNiRBkTtI8msPQeF/INTE-4085220"
}
}
}
Getting the grid id using an address
To get the location id of a given location using a postal, the following call can be used. As this call involves a Geo lookup to resolve the address to a latitude, longitude this has to be enabled specifically when subscribing to the API.
GET /grid/locate/address ?
config_id=<grid_id> &
address=<address>
The above API call will return something like the following if the location is found within the area represented by the configuration specified.
{
"success": {
"total": 2
},
"contents": {
"inputs": {
"type": "address",
"address": "502 Maggie Trl, Allen, TX"
},
"result": {
"id": "GRID-4085220",
"url": "https://grids.one/a/grid/gridcfg_UCu7wofFGyrUqTrV4V9NYgeF/GRID-4085220"
}
},
"copyright": {
"url": "grids.one",
"year": "2024"
}
}
Ratelimiting
Some of our API calls may be public(requires free API key) , while others requires paid subscription. To maintain our serice levels both public and private API endpoints are ratelimited. Please consult your specific plan that you subscribed to for the rate limit details.
Authentication
Currently we support API Key based authentication. Please set your Autorization Bearer request header with value of your API key. Alternatively you can also pass api_key= as a request parameter, though we strongly discourage this mode of passing the key, since it will allow others to see your key.
In curl this would mean sending the Authorization header like below.
curl -i <url> -H "Authorization: Bearer <api_key>"
If you are using PHP.
$authorization = "Authorization: Bearer <api_key>";
$ch = curl_init('<url>'); // Initialise cURL
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json' , $authorization ));
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); // OR GET
$result = curl_exec($ch);
curl_close($ch);
In javascript you can use headers key to add the authorization header
$.ajax({
url: '<url>'
type: 'GET',
contentType: 'application/json'
headers: {
'Authorization': 'Bearer <api_key>'
},
success: function (result) {
// CallBack(result);
},
error: function (error) {
}
});