Azure IoT 中心 - 批量创建或更新 REST API returns 错误
Azure IoT Hub - Bulk Create or Update REST API returns error
我正在尝试在 REST 调用中使用 preview version of the Azure IoT Hub API to create multiple devices (bulk)。 API 不断返回
"Request does not contain any devices"
这很奇怪,因为我完全按照文档格式化请求。
这是通话的详细信息:
主机 https://<hub-name>.azure-devices.net/devices?api-version=2019-07-01-preview
Headers Authorization: valid-sas-token-(tested this one), Content-Type: application/json
Body
{
"devices":[
{
"id":"TD_00000001",
"importMode":"create",
"status":"enabled",
"authentication":{
"symmetricKey":{
"primaryKey":null,
"secondaryKey":null
},
"x509Thumbprint":{
"primaryThumbprint":null,
"secondaryThumbprint":null
},
"type":"sas"
}
},
{
"id":"TD_00000002",
"importMode":"create",
"status":"enabled",
"authentication":{
"symmetricKey":{
"primaryKey":null,
"secondaryKey":null
},
"x509Thumbprint":{
"primaryThumbprint":null,
"secondaryThumbprint":null
},
"type":"sas"
}
}
]
}
这是我收到的回复
{
"Message": "ErrorCode:ArgumentInvalid;Request does not contain any devices",
"ExceptionMessage": "Tracking ID:2406c2332a83409aa73403d27c2f6083-G:4-TimeStamp:11/26/2019 03:10:17"
}
我已经测试了 SAS 令牌,我可以正常地向 IoT 中心发送和接收消息。任何帮助,将不胜感激。
文档不正确,请尝试以下操作:
[
{
"id":"TD_00000001",
"importMode":"create",
"status":"enabled"
},
{
"id":"TD_00000002",
"importMode":"create",
"status":"enabled"
}
]
您应该会收到以下回复:
{
"isSuccessful":true,
"errors":[],
"warnings":[]
}
我正在尝试在 REST 调用中使用 preview version of the Azure IoT Hub API to create multiple devices (bulk)。 API 不断返回
"Request does not contain any devices"
这很奇怪,因为我完全按照文档格式化请求。 这是通话的详细信息:
主机 https://<hub-name>.azure-devices.net/devices?api-version=2019-07-01-preview
Headers Authorization: valid-sas-token-(tested this one), Content-Type: application/json
Body
{
"devices":[
{
"id":"TD_00000001",
"importMode":"create",
"status":"enabled",
"authentication":{
"symmetricKey":{
"primaryKey":null,
"secondaryKey":null
},
"x509Thumbprint":{
"primaryThumbprint":null,
"secondaryThumbprint":null
},
"type":"sas"
}
},
{
"id":"TD_00000002",
"importMode":"create",
"status":"enabled",
"authentication":{
"symmetricKey":{
"primaryKey":null,
"secondaryKey":null
},
"x509Thumbprint":{
"primaryThumbprint":null,
"secondaryThumbprint":null
},
"type":"sas"
}
}
]
}
这是我收到的回复
{
"Message": "ErrorCode:ArgumentInvalid;Request does not contain any devices",
"ExceptionMessage": "Tracking ID:2406c2332a83409aa73403d27c2f6083-G:4-TimeStamp:11/26/2019 03:10:17"
}
我已经测试了 SAS 令牌,我可以正常地向 IoT 中心发送和接收消息。任何帮助,将不胜感激。
文档不正确,请尝试以下操作:
[
{
"id":"TD_00000001",
"importMode":"create",
"status":"enabled"
},
{
"id":"TD_00000002",
"importMode":"create",
"status":"enabled"
}
]
您应该会收到以下回复:
{
"isSuccessful":true,
"errors":[],
"warnings":[]
}