API Reference

This page explains how to use the aREST cloud API so you can directly access & control your devices connected to the aREST cloud.

Basic API information


All the API commands are done using the same base URL:

https://cloud.arest.io

Unless specified differently, all calls to the aREST API are GET requests.

Authentication

All calls to the aREST cloud API must be done by passing your API key (that you can find inside your account) in the query of the call. For example:

/your_command?key=your_key

Get Device Info

The simplest call you can do the aREST cloud is to get the ID, name and status of a device. You can do so with this command:

/device_id/id

Variables

You can use the aREST cloud API to get the current value of a variable defined on a device connected to aREST. The syntax is the following:

/device_id/your_variable

This will return the value of the variable if it is defined on the device & if the device is connected.

Digital Outputs

One of the main use of the aREST cloud API is to be able to control digital pins of your devices from anywhere in the world. You can do so with the following command:

/device_id/digital/pin_number/output_value

This will return a confirmation message that the output has been set, if the device is online.

Digital Mode

Some devices (like most Arduino boards) will require to set pins as an input or as an output prior to setting the pin itself. You can do that via this command:

/device_id/mode/pin_number/output_type

Where output_type can be i (input) or o (output).

Digital Inputs

You can also use the API to query the current value of a given digital pin, which will return 0 or 1. You can do so with this command:

/device_id/digital/pin_number

Analog Inputs

Similar to digital inputs, some boards will allow you to measure analog values. Careful, this command is not available on all pins of the boards, check your device documentation before using this command. The command is the following:

/device_id/analog/pin_number

Analog Outputs

Some boards allow you to set the value of some pins as analog values. Careful, this command is not available on all pins of the boards, check your device documentation before using this command. The command is the following:

/device_id/analog/pin_number/pin_value