Asset Tracking API
Asset tracking API allows storage of asset information in Grids.One system for later retrieval and analysis. The assets can be static (one asset, one location, all the time) or moving (one asset, possible multi location over time). This allows for overtime asset movement , concentration checks and other such logistical and risk management analysis.
Typical workflow
sequenceDiagram
API Client->>+Grids.One: PUT asset "{asset-id:OILWELL-234,location:lat,long}"
Note right of Grids.One: Look up grid Id for lat,long
Note right of Grids.One: Save asset-id,grid-id in DB
Grids.One-->>-API Client: Saved
API Client->>+Grids.One: GET "asset-id:OILWELL-234"
Note right of Grids.One: Lookup asset-id return details and grid Id
Store Asset
To store an asset send the asset id (most likely your primary key in your system to track the asset) and current location coordinates. The system will lookup the corresponding grid id for the given coordinates and saves the asset id, asset metadata and the grid id in the database.
PUT/POST /grid/asset ?
config_id=<config_id> &
asset_id=<asset_id> &
location=<lat,long>
meta=<info>
Retrieve Asset Information
To retrieve the grid id and metadata for a given asset or set of assets the following API call can be used.
GET /grid/metadata ?
config_id=<config_id> &
asset_ids=<id1,id2,id3>
Delete Asset
To delete an asset or multiple assets and the associated information you can use the following API call.
DELETE /grid/asset ?
config_id=<config_id> &
asset_ids=<id1,id2,id3>
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) {
}
});