AskSensors IoT Platform Documentation


Control Hardware with AskSensors over HTTP/HTTPS




As there are many IoT hardware available nowadays, AskSensors is not tied to some specific hardware or platform.
If your actuator device is connected to the internet, you can send commands and control it easily with AskSensors and start building your Internet of Things project in few minutes.
This guide describes how to control hardware and actuators with AskSensors.

Here is a list of how to use instructions provided for some popular platforms. To start using the platform select the development board you want to use:

1-Actuator HTTP/HTTPS Read API

2-Control ESP32 Actuators over HTTP/HTTPS



1-Actuator HTTP/HTTPS Read API

HTTP (Hypertext Transfer Protocol) is a request-response based protocol between a client and server. The HTTP can be used to enable communications between IoT devices (clients) and the AskSensors server.
The GET Request is one of the most common HTTP methods used to request data from a specified resource and can be used to read actuator commands from the AskSensors IoT platform.


a) API to read actuator commands from AskSensors:

Users can control their actuator devices manually from AskSensors Application. First, they need to create an Actuator device and send commands as described in this section. Then, the actuator devices receive these commands from the AskSensors cloud server in JSON format using the following HTTPS GET Request structure:

https://api.asksensors.com/read/apiKeyOut?module=Module_Number&maxResults=1
Where,
  • apiKeyOut: is the Actuator API KEY OUT.
  • Module_Number: is the module name (module1, module2...module6).
  • maxResults: The number of entries is fixed to 1 to get the lastest command set by the user in the AskSensors Application.
If the HTTP Get Request is performed well, you should Get a buffer with the specified number of enrties in JSON format:
Here are the response codes that you should get when reading data from the AskSensors IoT platform over HTTP/HTTPS:
  • 200: Corresponds to an OK HTTP code.
  • [{"value":"...","date":"..."}]: The data read buffer in JSON format.
The URL below shows an example to read the command "OFF" sent by the AskSensors user to the "module1" of the Actuator with "apiKeyOut = A4dAMRW6hjcSZ0bvv8ZULsagF0R7pOml:
https://api.asksensors.com/read/A4dAMRW6hjcSZ0bvv8ZULsagF0R7pOml?module=module1&maxResults=1

The response is the module values in Json format: [{"date":"12-29-2019 16:12:35.648","value":"OFF"}].