Getting Started with the REST API
The Echolo REST API is the main interface to the entire platform, it allows for full management and insight of 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 API Docs @ developer.echolo.io
Special note before moving on
All requests to the Echolo REST API require the use of a special API key named x-api-key
. This key is inserted to 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
The example below we are going to make a request for 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. In the case of your application not having any 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"
}
]
Related articles
-
Page:
-
Page:
-
Page:
-
Page:
-
Page: