Getting Started with the REST API
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!
First: Be sure to have a look at the Swagger API Docs
A special note before moving on
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.
API Versions
Before moving forward, please check the current API version here.
Authentication
Before moving on, please review the Authentication Guide. Make sure to review the token expiration and request example.
Request Data
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' } };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
Response
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"
}
]