CloudPlugs REST Library  1.0.0
for JavaScript
CloudPlugs JavaScript Client Library

CloudPlugs REST Client for JavaScript is a library to perform HTTP requests to CloudPlugs servers. The official repository is:

The Cloudplugs IoT Platform

Cloudplugs is a cloud based IoT platform to enable the fast prototyping, connection, deployment and management of smart "Things" (sensors, smartphones, home appliances, etc.). Different objects can interact with each other by publishing and/or reading any type of data on shared channels through simple communication protocols. You can learn more at and you can sign-up on to start connecting your Things.

Library Guide

You can use this library to perform HTTP requests to the CloudPlugs platform either from a browser or as a Node.js module.


Download the library and copy the file in your project directory. To use the library from within a browser readable page include it in your page:

<script src=""></script>

If you are using the library as a Node.js module include it in your script:

var cloudplugs = require('./');


Create a new instance, setting the initialization parameters:

  • id String - the authentication identifier.
  • password String - the authentication password.
  • isMaster bool - to run the script as a master user
  • debug bool - optional, trace activity in the console and accept invalid https certificates. Default: false.
  • url String - optional, Set an URL that will be used as base for all web services. Default: https// .
  • acceptUnauthorized bool - optional, in case of https, the certificate won't be verified. Default: false.
  • dontLoadCA bool - optional, prevent the library from loading the included CA certificates. Default: false.


AUTH_PLUGID = 'dev-xxxxxxxxxxxxxxxxxx';
AUTH_PASS = 'your-password';
var client = new cloudplugs.RestClient({
password: AUTH_PASS,

Now you are ready to to invoke methods and perform REST requests to the server!

Executing REST HTTP requests

When your instance of the library is ready, you can execute HTTP requests to the server by invoking any of the request methods. All the requests are asynchronous and are performed according to the Cloudplugs REST API documentation. Example:

entries: [{ channel:'temperature', data:getTemp() }],
cb: function(err,id) {
console.log('Publication: '+(err ? 'failed' : 'successful'));
if (err) {