全部產品
Search
文件中心

IoT Platform:ClearDeviceDesiredProperty

更新時間:Feb 17, 2025

調用該介面清空裝置已設定的期望屬性值。

使用說明

  • 調用本介面時,必須傳入要清空的屬性標識符(Identifies)。如果不傳入Identifies,調用會失敗。
  • 單次調用本介面,Identifies最多可傳入10個屬性標識符。
  • 調用本介面清空期望屬性值成功後,調用QueryDeviceDesiredProperty介面查詢期望屬性值時,會返回對應參數Identifier(屬性標識符),不會返回對應參數Value了。

QPS限制

單個阿里雲帳號調用該介面的每秒請求數(QPS)最大限制為50。

說明 RAM使用者共用阿里雲帳號配額。

調試

您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。

請求參數

名稱 類型 是否必選 樣本值 描述
Action String ClearDeviceDesiredProperty

系統規定參數。取值:ClearDeviceDesiredProperty。

IotInstanceId String iot-2w****

執行個體ID。您可在物聯網平台控制台的執行個體概覽頁面,查看當前執行個體的ID

重要
  • 若有ID值,必須傳入該ID值,否則調用會失敗。
  • 若無執行個體概覽頁面或ID值,則無需傳入。

執行個體的更多資訊,請參見執行個體概述

ProductKey String a1BwAGV****

要清空期望屬性值的裝置所屬的產品ProductKey

說明 如果傳入該參數,需同時傳入DeviceName
DeviceName String light

要清空期望屬性值的裝置名稱。

說明 如果傳入該參數,需同時傳入ProductKey
Identifies.N RepeatList temperature

要清空期望屬性值的屬性標識符列表。屬性標識符個數不能超過10個。

IotId String Q7uOhVRdZRRlDnTLv****00100

要清空期望屬性值的裝置ID。物聯網平台為該裝置頒發的ID,裝置的唯一識別碼。

說明 IotId作為裝置唯一識別碼,和ProductKeyDeviceName組合是一一對應的關係。如果傳入該參數,則無需傳入ProductKeyDeviceName。如果您同時傳入IotIdProductKeyDeviceName組合,則以IotId為準。

調用API時,除了本文介紹的該API的特有請求參數,還需傳入公用請求參數。公用請求參數說明,請參見公用參數文檔

返回資料

名稱 類型 樣本值 描述
Code String iot.system.SystemException

調用失敗時,返回錯誤碼。詳細資料,請參見下文錯誤碼

Data Struct

調用成功時,返回的資料。

Versions String {\"temperature\":0}

本次清空期望屬性值後,對應屬性的期望屬性值的最新版本號碼。

ErrorMessage String 系統異常

調用失敗時,返回的出錯資訊。

RequestId String E55E50B7-40EE-4B6B-8BBE-D3ED55CCF565

阿里雲為該請求產生的唯一識別碼。

Success Boolean true

是否調用成功。

  • true:調用成功。
  • false:調用失敗。

樣本

請求樣本

https://iot.cn-shanghai.aliyuncs.com/?Action=ClearDeviceDesiredProperty
&ProductKey=a1BwAGV****
&DeviceName=device1
&Identifies.1=temperature
&<公用請求參數>

正常返回樣本

XML格式

<ClearDeviceDesiredPropertyResponse>
  <RequestId>E55E50B7-40EE-4B6B-8BBE-D3ED55CCF565</RequestId>
  <Data>
        <Versions>{"temperature":0}</Versions>
  </Data>
  <Code></Code>
  <Success>true</Success>
</ClearDeviceDesiredPropertyResponse>

JSON格式

{
    "RequestId": "E55E50B7-40EE-4B6B-8BBE-D3ED55CCF565",
    "Data": {
        "Versions": "{\"temperature\":0}"
    },
    "Code": "",
    "Success": true
}

錯誤碼

HttpCode 錯誤碼 錯誤資訊 描述
400 iot.device.InvalidFormattedDeviceName The DeviceName format is invalid. 裝置名稱格式錯誤。
400 iot.device.NotSupportExemptionValidateType The feature does not support the specified verification type. 該功能不支援物模型免校正類型。
400 iot.prod.NotExistedProduct The specified product does not exist. 指定的產品不存在。
400 iot.prod.QueryProductPropertyFailed An error occurred while querying the product property. 查詢產品屬性失敗。
400 iot.check.InvalidFormattedParameter The parameter format is invalid. 參數格式錯誤。
400 Iot.digitaltwin.DTInstanceInvalidThingType The digital twin operation is not supported. 孿生資料類型不支援使用此介面訪問。
400 iot.check.NullParameter Specify parameter is null. 參數{}不可為空。
400 iot.device.CanNotSetReadOnlyProperty Cannot set read only property. 無法設定唯讀屬性。
400 iot.device.DeviceIsDisable The specified device has been disabled. 真實裝置被禁用。
400 iot.device.InvalidIoTId The specified device ID is invalid. 裝置ID錯誤。
400 iot.device.NullDeviceName The DeviceName parameter cannot be empty. 裝置名稱不可為空。
400 iot.prod.NullProductKey The ProductKey parameter cannot be empty. 入參產品ProductKey不可為空。
400 iot.prod.InvalidFormattedProductkey The ProductKey format is invalid. 入參產品ProductKey格式錯誤。
400 iot.common.InvalidTenant The Invalid tenant. 不合法的租戶或者建立租戶失敗。
400 iot.prod.QueryPropertyNotFound Query property not found. 查詢屬性不存在。
400 iot.device.ClearPropertyDesiredFailed Failed to clear desired value of property. 清空屬性期望值失敗。
400 iot.prod.QueryProductAbilitiesNotFound query product abilities not found. 擷取產品功能不存在。
400 iot.Device.NotExistedDevice This device does not exist. 裝置不存在或未啟用。
400 iot.prod.NullAbilityIdentifier You must specify a feature identifier. 功能標識符不可為空。
400 iot.system.IllegalRequest The request parameter is invalid. 非法的請求參數。

訪問錯誤中心查看更多錯誤碼。