你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Sensor Data Models - Create Or Update
创建传感器数据模型实体。
PATCH {endpoint}/sensor-partners/{sensorPartnerId}/sensor-data-models/{sensorDataModelId}?api-version=2023-11-01-preview
URI 参数
名称 | 在 | 必需 | 类型 | 说明 |
---|---|---|---|---|
endpoint
|
path | True |
string uri |
命名空间的主机名,例如 admaInstanceName.farmbeats.azure.net |
sensor
|
path | True |
string |
传感器数据模型的 ID。 |
sensor
|
path | True |
string |
传感器合作伙伴的 ID。 |
api-version
|
query | True |
string |
请求的 API 版本 |
请求头
Media Types: "application/merge-patch+json"
名称 | 必需 | 类型 | 说明 |
---|---|---|---|
Authorization | True |
string |
请为授权的 API 调用提供有效的持有者令牌。 请注意,如果之前尝试过未经身份验证的调用,则可能需要清除浏览器缓存。 |
请求正文
Media Types: "application/merge-patch+json"
名称 | 必需 | 类型 | 说明 |
---|---|---|---|
measures | True |
<string,
Sensor |
将传感器类型映射到传感器度量值。 |
description |
string |
资源的文本说明。 |
|
manufacturer |
string |
传感器制造商。 |
|
name |
string |
用于标识资源的名称。 |
|
productCode |
string |
Sensor productCode。 |
|
properties |
属于资源的键值对的集合。 每对的键不能超过 50 个字符,并且值不能大于 150 个字符。 注意:最多可以为资源提供 25 个键值对,并且仅支持字符串、数字和 datetime (yyyy-MM-ddTHH:mm:ssZ) 值。 |
||
status |
string |
资源的状态。 |
|
type |
string |
传感器的类型。 |
响应
名称 | 类型 | 说明 |
---|---|---|
200 OK |
Success |
|
201 Created |
创建 |
|
Other Status Codes |
错误 标头 x-ms-error-code: string |
安全性
Authorization
请为授权的 API 调用提供有效的持有者令牌。 请注意,如果之前尝试过未经身份验证的调用,则可能需要清除浏览器缓存。
类型:
apiKey
在:
header
示例
SensorDataModels_CreateOrUpdate
示例请求
PATCH {endpoint}/sensor-partners/sp1/sensor-data-models/sdm124?api-version=2023-11-01-preview
{
"type": "Sensor",
"manufacturer": "Some sensor manufacturer",
"productCode": "soil m",
"measures": {
"soilMoisture": {
"description": "measures soil moisture",
"dataType": "Bool",
"type": "sm",
"unit": "none",
"properties": {
"abc": "def",
"elevation": 5
}
}
},
"status": "new",
"name": "my sdm for soil moisture",
"description": "description goes here",
"properties": {
"key1": "value1",
"key2": 123.45
}
}
示例响应
{
"type": "Sensor",
"manufacturer": "Some sensor manufacturer",
"productCode": "soil m",
"measures": {
"soilMoisture": {
"description": "measures soil moisture",
"dataType": "Bool",
"type": "sm",
"unit": "none",
"properties": {
"abc": "def",
"elevation": 5
}
}
},
"sensorPartnerId": "sp1",
"id": "sdm124",
"status": "new",
"createdDateTime": "2022-01-24T06:12:15Z",
"modifiedDateTime": "2022-01-24T06:12:42Z",
"eTag": "040161a2-0000-0700-0000-61ee435a0000",
"name": "my sdm for soil moisture",
"description": "description goes here",
"properties": {
"key1": "value1",
"key2": 123.45
}
}
{
"type": "Sensor",
"manufacturer": "Some sensor manufacturer",
"productCode": "soil m",
"measures": {
"soilMoisture": {
"description": "measures soil moisture",
"dataType": "Bool",
"type": "sm",
"unit": "none",
"properties": {
"abc": "def",
"elevation": 5
}
}
},
"sensorPartnerId": "sp1",
"id": "sdm124",
"status": "new",
"createdDateTime": "2022-01-24T06:12:15Z",
"modifiedDateTime": "2022-01-24T06:12:15Z",
"eTag": "040158a0-0000-0700-0000-61ee433f0000",
"name": "my sdm for soil moisture",
"description": "description goes here",
"properties": {
"key1": "value1",
"key2": 123.45
}
}
定义
名称 | 说明 |
---|---|
Error |
Azure AgPlatform 服务出错。 |
Error |
来自 Azure AgPlatform 服务的错误响应。 请参阅 https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses ErrorResponse 参考文档。 |
Inner |
包含错误列表的内部错误。有关 InnerError 参考文档,请参阅 https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#innererror--object 。 |
Sensor |
SensorModel API 模型。 |
Sensor |
传感器模型度量详细信息。 |
Sensor |
传感器度量数据类型。 |
Error
Azure AgPlatform 服务出错。
名称 | 类型 | 说明 |
---|---|---|
code |
string |
服务器定义的错误代码集。 |
details |
Error[] |
有关导致此报告错误的特定错误的详细信息数组。 |
innererror |
包含错误列表的内部错误。有关 InnerError 参考文档,请参阅 https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#innererror--object 。 |
|
message |
string |
错误的用户可读表示形式。 |
target |
string |
错误的目标。 |
ErrorResponse
来自 Azure AgPlatform 服务的错误响应。 请参阅 https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses ErrorResponse 参考文档。
名称 | 类型 | 说明 |
---|---|---|
error |
Azure AgPlatform 服务出错。 |
|
traceId |
string |
唯一跟踪 ID。 |
InnerError
包含错误列表的内部错误。有关 InnerError 参考文档,请参阅 https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#innererror--object 。
名称 | 类型 | 说明 |
---|---|---|
code |
string |
包含的错误提供的特定错误代码。 |
innererror |
包含错误列表的内部错误。有关 InnerError 参考文档,请参阅 https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#innererror--object 。 |
SensorDataModel
SensorModel API 模型。
名称 | 类型 | 说明 |
---|---|---|
createdBy |
string |
由用户/租户 ID 创建。 |
createdDateTime |
string |
创建资源的日期时间,示例格式:yyyy-MM-ddTHH:mm:ssZ。 |
description |
string |
资源的文本说明。 |
eTag |
string |
实现乐观并发的 ETag 值。 |
id |
string |
资源的 ID。 |
manufacturer |
string |
传感器制造商。 |
measures |
<string,
Sensor |
将传感器类型映射到传感器度量值。 |
modifiedBy |
string |
由用户/租户 ID 修改。 |
modifiedDateTime |
string |
上次修改资源的日期时间,示例格式:yyyy-MM-ddTHH:mm:ssZ。 |
name |
string |
用于标识资源的名称。 |
productCode |
string |
Sensor productCode。 |
properties |
属于资源的键值对的集合。 每对的键不能超过 50 个字符,并且值不能大于 150 个字符。 注意:最多可以为资源提供 25 个键值对,并且仅支持字符串、数字和 datetime (yyyy-MM-ddTHH:mm:ssZ) 值。 |
|
sensorPartnerId |
string |
关联的传感器合作伙伴的 ID。 |
status |
string |
资源的状态。 |
type |
string |
传感器的类型。 |
SensorDataModelMeasure
传感器模型度量详细信息。
名称 | 类型 | 说明 |
---|---|---|
dataType |
传感器度量数据类型。 |
|
description |
string |
传感器度量值的说明。 |
properties |
传感器数据模型的键值对集合。 每对的键不能超过 50 个字符,并且值不能大于 150 个字符。 注意:最多可以为模型提供 25 个键值对,并且仅支持字符串、数字和日期时间 (yyyy-MM-ddTHH:mm:ssZ) 值。 |
|
type |
string |
传感器数据的度量类型。 |
unit |
string |
传感器度量单位。 |
SensorDataType
传感器度量数据类型。
名称 | 类型 | 说明 |
---|---|---|
Bool |
string |
|
DateTime |
string |
|
Double |
string |
|
Long |
string |
|
String |
string |