Introduction

The Remote IoT API allows even more automation and integration of Remote IoT service into your system. Use these web services to access to your device from anywhere.

If you cannot find a method to achieve your objective or are struggling to use the API, please contact our support team with any questions you may have.

Authorization

To authorize, use this code:



curl "api_endpoint_here"
  -H "Authorization: Bearer json_web_token"

Make sure to replace json_web_token with your token.

All of the requests to via the API need to be authorized. Once the token is generated, it needs to be added as a header with the prefix Bearer.

The full http header looks like:

Authorization: Bearer json_web_token

please go to the API access page to find your json_web_token.

Devices

Devices services are an important feature of Remote IoT. They allow for much more flexibility to access your device.

Retrieve Devices

Retrieve a list of your devices which have been registered. On success the api will respond with a list of your devices in JSONArray format.

curl https://remote-iot.com/portal/api/device \
  -X GET \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer json_web_token"

HTTP Request

GET https://remote-iot.com/portal/api/device

Example of server response:

[{
    "UnitId": "0000000088888888",
    "External_ip": "10.10.10.255",
    "Internal_ip": "192.168.0.101",
    "Name": "Raspberry pi 001"
}]

JSON Response

The Response is a JSONArray object.

Parameter Data Type Description
UnitId string This is the device id.
External_ip string The address assigned to you by your Internet Service Provider that is how the Internet and all other computers outside your local network see you.
Internal_ip string The address that is assigned by your local network router. These IP addresses can only be seen by other computers in your local network and not by any computers connected in an external network such as on the Internet.
Name string This is the device name.

Rename Device

curl https://remote-iot.com/portal/api/rename \
  -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer json_web_token" \
  -d '{
    "UnitId":"0000000088888888",
    "Name":"Test3"
  }'

HTTP Request

POST https://remote-iot.com/portal/api/rename

JSON Body Parameters

Parameter Data Type Description
UnitId string This is the device id.
Name string This is the new name.

JSON Response

On success the api will respond HTTP Status Code 200.

Retrieve Status

Retrieve the status of the device. The status is online or offline.

curl https://remote-iot.com/portal/api/status \
  -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer json_web_token" \
  -d '[{"UnitId":"0000000088888880"},{"UnitId":"0000000088888881"},{"UnitId":"0000000088888882"}]'

JSON Body Parameters

A list of unit id in JSONArray format

[{
    "UnitId": "0000000088888888",
    "Status": "Online"},
    {
    "UnitId": "0000000088888881",
    "Status": "Offline"
}]

JSON Response

Parameter Data Type Description
UnitId string This is the device id.
Status string This is the status of the device. This is Online or Offline.

Connect Device

Setup a remote connect with your device. On success the api will respond the Host name and Port number. You may login your device with it.

curl https://remote-iot.com/portal/api/connect \
  -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer json_web_token" \
  -d '{
    "UnitId":"0000000088888888",
    "LocalPort":"22"
  }'

HTTP Request

POST https://remote-iot.com/portal/api/connect

JSON Body Parameters

Parameter Data Type Description
UnitId string This is the device id.
LocalPort string This is the local port in your device. For example 22 for ssh login.

JSON Response

{
    "Host": "proxy7.remote-iot.com",
    "Port": 23401,
    }
Parameter Data Type Description
Host string This is the remote host name.
Port integer This is the remote port number.

Batch Job

Submit Job

Execute a bash script or a shell command in your device.

curl https://remote-iot.com/portal/api/submitjob \
  -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer json_web_token" \
  -d '{
    "JobName":"Job1",
    "UnitId":"0000000088888888",
    "ExecuteTime":"2017-05-19 00:00:00",
    "Script":"test1.sh",
    "Command":"ls"}
  }'

HTTP Request

POST https://remote-iot.com/portal/api/submitjob

JSON Body Parameters

Parameter Data Type Description
JobName string This is the job name.
UnitId string This is the device id.
ExecuteTime string Execute the script in a specific time.
Script string Execute a script file which has been uploaded in portal.
Command string Execute a Linux command. If the 'Script' field is not null, the field is ignored.

JSON Response

On success the api will respond HTTP Status Code 200.

List Jobs

Return the status and the output of these batch jobs.

curl https://remote-iot.com/portal/api/listjob \
  -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer json_web_token"

HTTP Request

POST https://remote-iot.com/portal/api/listjob

JSON Response

The Response is a JSONArray object.

[{
    "Name": "Test1"
    "UnitId": "0000000088888888",
    "Status": "Executed",
    "SubmitTim": "2017-01-10 10:02:30.0"
    "ExecuteTim": "2017-01-10 10:02:30.0"
    "Script": "test.sh",
    "Command": ""
    "Result": ""
}]
Parameter Data Type Description
Name string This is the name of the job.
UnitId string This is the device id.
Status string This is the status of the batch job. This is "Executed" or "Pending".
SubmitTim string This is submit time of the job.
ExecuteTim string This is execution time of the job.
Script string This is the script file name.
Result string This is the output of the job.

Errors

This section can detail the different error responses.

Error Code Meaning
400 Bad Request – Your request sucks
401 Unauthorized – Your API key is wrong
403 Forbidden – Too many requests from the same client IP; Dynamic IP Restriction limit reached.
404 Not Found – The specified request or data could not be found
500 Internal Server Error – We had a problem with our server. Try again later.
503 Service Unavailable – We’re temporarially offline for maintanance. Please try again later.