README
Antares NodeJS

This is a NodeJS library to simplify the connection to Antares IoT Platform. For more information about the platform itself, please visit the official site.
Installation
Make sure you have NodeJS and npm installed.
npm install antares-http --save
Usage Example
var antares = require('antares-http');
var myData = {
temperature: 30,
humidity: 78
}
antares.setAccessKey('your-access-key-here');
antares.send(myData, 'your-project-name', 'your-device-name')
.then(function(response) {
console.log(response);
});
API Reference
setAccessKey(access-key)
Set theaccess-key
parameter to your Antares access key.
Functions below this line use Promise
to return the response of each HTTP request, so you'll need to use a .then
to retrieve the result. For example:
antares.get('project1', 'device1')
.then(function(response) {
console.log(response.content);
});
For more information about promises, please read more at Mozilla Developer Guide;
get(projectName, deviceName)
Get the latest data from your Antares device.
return: latest data (json)getAll(projectName, deviceName, limit)
Get a chunk of data from your Antares project, you can set the limitation by setting thelimit
parameter.
return: Chunk of data from your Antares devicegetAllId(projectName, deviceName, limit)
Get a chunk of data IDs from your Antares project, you can set the limitation by setting thelimit
parameter.
return: Chunk of data IDs from your Antares devicegetSpecific(projectName, deviceName, data-id)
Get specific data from your Antares device, thedata-id
parameter looks like this:cin_81723819
.
return: Specific device datagetDeviceId(projectName, deviceName)
Get your Antares device ID.
return: antares device ID (i.e.cnt-44637281
)send(data, projectName, deviceName)
Send data to your Antares project. This can be a JavaScript object or other datatype (string/number).
return: POST response data from AntaressendById(data, device-id)
Send data to your Antares device through Antares device ID which looks likecnt-281727372
return: POST response data from AntarescreateDevice(projectName, newDeviceName)
Create an Antares device in your Project.
return: device creation responsegetDevices(projectName)
Get all device names of Antares project
return: antares device names