How to send commands to devices using REST API

This guide will show you how to send commands to a device using REST API and how to send commands to multiple devices within a Tag.

Requisites

The Commands REST API resource requires the following information when using it:

Resources used

  • Commands > Get
  • Commands > Post

See available commands

This step is optional, but helps to retrieve already available commands from the devices.

To see the available commands for a device follow these steps:

1. Log in to http://host_name/comGpsGate/api/v.1/test 

Note: replace host_name with your actual server IP address or DNS name.

2. Click on the resource name GET/applications/...../commands> Try it out option.

mceclip2.png

3. Enter the following details:

mceclip0.png

If the commands are available, they will be listed under the Response area

mceclip1.png

Sending the command

1. Log in to http://host_name/comGpsGate/api/v.1/test 

Note: replace host_name with your actual server IP address or host name.

2. Click on the resource name POST/applications/...../commands> Try it out option.

mceclip5.png

3. Enter the following details:

{
"command": "getinfo"
}

Note: make sure your device is compatible with the command you try to send. Check your device documentation to send the right commands to your devices.

mceclip3.png

If the command was successful, you will see the 200 state and the Response below:

mceclip4.png