The Echolo REST API is the main interface to the entire platform; it allows for complete management and insight into your end devices and communication hubs. The following is a "Quick Start Guide" to help you get up and running, so let's get started!
<aside> âšī¸ First: Be sure to have a look at the Swagger API Docs
</aside>
All requests to the Echolo REST API require using a unique API key named x-api-key
. This key is inserted into the request as a header and should be present for all authenticated and non-authenticated requests.
{
"message": "Forbidden"
}
The error means that you did not include the x-api-key
as a header in your request OR that the key is no longer valid.
Before moving forward, please check the current API Versions.
Before moving on, please review the Authentication. Make sure to review the token expiration and request example.
In the example below, we will request all Hubs
registered to the application
through appId
. We will use the hub
path /hub
with our newly created token
to get all hubs.
var request = require("request");
var options = { method: 'GET',
url: '<https://api.echolo.io/v2/hub>',
headers:
{ 'x-api-key': 'x-api-key',
token: 'token',
'app-id': 'app-id' } }; // NOTE: app-id header has changed to appId in API v3
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
<aside>
đī¸ Application ID Header:
When using v3 of the API please make sure to use appId
vs app-id
.
</aside>
If your application has registered hubs, an Array of all hubs will be returned. If your application does not have registered hubs, an empty Array will be returned.
[
{
"hubId":"echolo-hub-0",
"appId":"xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"lastSeenDate":"Mon Mar 12 2018 19:40:17 GMT+0000 (UTC)",
"key":"xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"environment": "String",
"sku": "String",
"mfgSn": "String"
},{
"hubId":"echolo-hub-1",
"appId":"xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"lastSeenDate":"Mon Feb 26 2018 03:02:22 GMT+0000 (UTC)",
"key":"xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"environment": "String",
"sku": "String",
"mfgSn": "String"
},{
"hubId":"echolo-hub-2",
"appId":"xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"lastSeenDate":"Mon Feb 26 2018 03:06:31 GMT+0000 (UTC)",
"key":"xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx",
"environment": "String",
"sku": "String",
"mfgSn": "String"
}
]