CloudPlugs REST Library  1.0.0
for Arduino
CloudPlugs Arduino Client Library

CloudPlugs REST Client for Arduino 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


Requires the new Ethernet library API (with DHCP and DNS) which is in Arduino 1.0 and later


  1. Download the latest version of the library from and save the file somewhere
  2. In the Arduino IDE, go to the Sketch -> Import Library -> Add Library... menu option
  3. Find the zip file that you saved in the first step, and choose that
  4. Check that it has been successfully added by opening the Sketch -> Import Library menu. You should now see CloudPlugs listed among the available libraries.


In normal usage, handles the outgoing request and Host header. The returned status code is parsed for you, as is the Content-Length header (if present). Because it expects an object of type Client, you can use it with any of the networking classes that derive from that. Which means it will work with EthernetClient, WiFiClient and GSMClient.

  • include dependencies. Example:
    #include <SPI.h>
    #include <Ethernet.h>
    #include "CloudPlugs.h"
  • Create new istance of the client:
    CloudPlugs client;
  • Define your own setup() function. Example:
    void setup() {
    // initialize serial communications at 9600 bps:
    Serial.println("connect to network");
    byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
    while (Ethernet.begin(mac) != 1) {
    Serial.println("Error getting IP address via DHCP, trying again...");
  • Configure your client and define your own loop() function to perform HTTP requests. See the examples for more details on how the library is used.


There are a few configuration parameters available for customization (if needed) before invoking any HTTP request. This parameters are:

  • auth id: the authentication identifier
  • auth pass: the authentication password
  • auth master: true to authenticate using the main account password
  • host: the base URL for HTTP requests

    // setAuth( authId, authPass, isAuthMaster)
    client.setAuth("your_plugid", "your_password", false);

Execute Rest HTTP requests

After configuration, you can execute HTTP requests to the server by invoking any of the request functions. All the requests are synchronous and are performed according to CloudPlugs Rest API documentation. Example:

String response = "";
boolean result = client.publishData("foo", "{\"data\":{\"temp\":7}}", response);