CloudPlugs REST Client for JavaScript is a library to perform HTTP requests to CloudPlugs servers. The official repository is: https://github.com/cloudplugs/rest-js
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 http://www.cloudplugs.com/how-it-works/ and you can sign-up on http://www.cloudplugs.com/register to start connecting your Things.
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 cp.rest.lib.js
file in your project directory. To use the library from within a browser readable page include it in your page:
If you are using the library as a Node.js module include it in your script:
Create a new instance, setting the initialization parameters:
Example:
Now you are ready to to invoke methods and perform REST requests to the server!
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: