Console 1.3.0

The REST API behind every device resource

In the last console update (1.3.0), we have introduced some new features to improve the development of clients that interact with the devices connected to the IoT platform.

From the archive: written in October 2016, for console 1.3.0. Today a device connected over IOTMP still exposes its resources as a live REST API: see Device connectivity.

In this case, we have enabled the Show Query feature that was available in the Device API. It displays the REST API calls that the console makes while interacting with the device. These calls can be used and integrated in other programs, like clients in .NET, PHP, Node.JS, C++, C, bash, etc. We hope this new feature will enable easier integrations, expanding the possibilities and integrations in different ecosystems.

The call

Method, authorization, body and response

The default REST API call shows the method used, the request authorization, the body and the response given by the device.

Here it is for a resource called led on a device called nodemcu:

API REST · Overview
// Method
POST https://api.thinger.io/v2/users/alvarolb/devices/nodemcu/led

// Authorization
Bearer <your_access_token>

// Request body
{
  "in": false
}

Token shown as a placeholder

From the terminal

Call a device resource with curl

The same call to a device resource, like the led of this example, from curl: open your terminal to turn things on and off easily.

API REST · Curl
curl \
  -H "Content-Type: application/json;charset=UTF-8" \
  -H "Authorization: Bearer <your_access_token>" \
  -H "Accept: application/json, text/plain, */*" \
  -X POST \
  -d '{"in":false}' \
  https://api.thinger.io/v2/users/alvarolb/devices/nodemcu/led

Token shown as a placeholder

You can try to update your resources directly from the console, and see how the requests are updated dynamically!

We will add more examples soon for doing queries with different clients, like PHP or Node.JS.

Every device, one API

Connect your devices and call their resources from any program.