Description

There is related API available to invoke on Milesight gateway, user can follow below steps to test related API by Postman.


Requirement

  • Milesight Gateway
  • A Windows System Computer
  • Postman Software


Configuration

Step 1. Download API command json file at the end of this article.

Step 2. Download and install Postman software installation from below link by browser first: https://www.postman.com/downloads/

Open Postman, Click File > Import > Import File to upload and import the API command file.

Step 3. After importing it, we can see Collection interface generate a LW_ API file.


Step 4. When clicking first Authentication commands, we will get detail command information on the right side text box.

Step 5. Authenticate and get a token key.

This test gateway IP address is 192.168.23.164, there is a sensor activated on this gateway, here are its all information:

Device Name: WS525

Device EUI: 24E124148B137836

App Name: cloud

Modify {{LW_IP}} to gateway IP address, click Send, then we will get token key reply soon.

Step 6. Click eye icon at the top-right corner to create an environment to save all parameter values.

Click Add to create a new environment, name this environment.


Fill in all variables name and values like below, then click Save .

IP_LW: The gateway IP address, here is 192.168.23.164.

tooken: Paste relate content copied in login authentication step.

Dev_eui: Device EUI of the sensor activated in gateway.

dev_name: Device name of the sensor created in gateway.

app_name: Application name of this sensor used in gateway to activate.

You have finished to create an environment file at the top-right corner.

Step 7. Choose the environment create in step 6, when other commands at left chosen, user can click Send to get response directly.

Example:

1)Get_Devices_ByName

2)Add_Device_Queue

We can send related downlink command to sensor by this API. Click Add_Device_Queue > Body, we can get related downlink content here:

  • confirmed: false or true. When choosing true, end-device will reply ACK message packet to server after it receives this downlink command. Else, it won’t do any reply about it.
  • data: The downlink command to control corresponding device, get it from related device user guide or manufacturer.
  • dev EUI: Paste the Device EUI.
  • fPort: The port which LoRaWAN devices receive downlinks, it can be checked from related sensor user guide or manufacturer. For Milesight end devices, the port is 85 by default.

Here, we modify the body content like below to change report interval of WS525 to 1 min:

{
    "confirmed": true,
    "data": "/wM8AA==",
    "devEUI": "24E124148B137836",
    "fPort": 85
}

Then click Send, if we accessing to gateway web GUI, go to Network Server > Packets this time, we will see gateway received downlink packet, and then get a ACK reply from sensor soon.

Note: User can get related downlink command from sensor manufacturer, remember to converse downlink command to Base64 format data content first. You can converse downlink data format form below website: https://conv.darkbyte.ru/