OTA Upgrade

Last Updated on : 2021-04-25 08:35:21download

This topic describes the related APIs of over-the-air (OTA) update.

Request method API Description
GET /v1.0/devices/{device_id}/upgrade-infos Get update information of the device
PUT /v1.0/devices/{device_id}/confirm-upgrade Confirm update status of the device.

Get update information of the device

API description

Get update information of the device

API address

GET /v1.0/devices/{device_id}/upgrade-infos

Request parameter

Parameter name Data type Parameter type Required Description
device_id Long URI Yes Device ID
lang String URL No Multilingual

Return parameter

Parameter name Data type Description
code Integer Error code.
success Boolean Whether the request succeeded or not.
  • true: succeeded
  • false: failed
msg String The message returned if the request fails. It will return null if the request succeeds.
result List<result> The returned result.

result

Parameter name Data type Description
upgrade_status Integer Update status:
  • 0: No need to update
  • 1: Hardware prepared
  • 2: Updating
  • 3: Update complete
  • 4: Update failed
current_version String The current version
upgrade_version String The version for update
module_type String Module type:
  • 0: Wi-Fi
  • 1: Bluetooth
  • 2: GPRS
  • 3: Zigbee
  • 4: IR
  • 5: 433 gateway
  • 6: NB-IoT
  • 9: MCU
module_desc String Module description
last_upgrade_time String The latest update time
upgrade_desc String The description of update

Request example

GET /v1.0/devices/vedeo71y2387123/upgrade-infos

Return example

{ "success":true, "t":1541071460239, "result":[ { "upgrade_status":0, "current_version":"", "upgrade_version":"", "module_type": 0, "module_desc":"", "last_upgrade_time": 1541071460236, "upgrade_desc":"" } ] }

Error code

The following are common service exceptions for this API. For more exception errors, see Error Code.

Error code Description
500 System error
1106 Illegal permission

Confirm update status of the device

API description

Confirm update status of the device.

API address

PUT /v1.0/devices/{device_id}/confirm-upgrade

Request parameter

Parameter name Data type Parameter type Required Description
device_id Long URI Yes Device ID
module_type Integer Body Yes Module type

Return parameter

Parameter name Data type Description
code Integer Error code.
success Boolean Whether the request succeeded or not.
  • true: succeeded
  • false: failed
msg String The message returned if the request fails. It will return null if the request succeeds.
result Boolean The returned result.

Request example

PUT /v1.0/devices/deveo12y423323/confirm-upgrade

{
    "module_type": 1
}

Return example

{ "success":true, "t":1541071460239, "result": true }

Error code

The following are common service exceptions for this interface. For more exception errors, see Error code.

Error code Description
500 System error
1106 Illegal permission