你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Time Series Instances - Execute Batch
对多个时序实例执行批量获取、创建、更新和删除操作。
POST https://{environmentFqdn}/timeseries/instances/$batch?api-version=2020-07-31
URI 参数
名称 | 在 | 必需 | 类型 | 说明 |
---|---|---|---|---|
environment
|
path | True |
string |
按环境 FQDN,例如 10000000-0000-0000-0000-100000000109.env.timeseries.azure.com。 可以从获取环境 API、Azure 门户或 Azure 资源管理器的响应中获取此域名。 |
api-version
|
query | True |
string |
要与客户端请求一起使用的 API 的版本。 当前支持的版本为“2020-07-31”。 |
请求头
名称 | 必需 | 类型 | 说明 |
---|---|---|---|
x-ms-client-request-id |
string |
可选的客户端请求 ID。 服务记录此值。 允许服务跨服务跟踪操作,并允许客户就特定请求联系支持人员。 |
|
x-ms-client-session-id |
string |
可选的客户端会话 ID。 服务记录此值。 允许服务跨服务跟踪一组相关操作,并允许客户就特定请求组联系支持人员。 |
请求正文
名称 | 类型 | 说明 |
---|---|---|
delete |
要删除的时序实例。 可以指定时序 ID 或名称。 |
|
get |
要返回的时序 ID 或时序实例的名称。 |
|
put |
要创建或更新的时序实例。 |
|
update |
要更新的时序实例。 如果实例不存在,则返回错误。 |
响应
名称 | 类型 | 说明 |
---|---|---|
200 OK |
成功的操作。 Headers x-ms-request-id: string |
|
Other Status Codes |
意外错误。 Headers x-ms-request-id: string |
安全性
azure_auth
Azure Active Directory OAuth2 流
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
名称 | 说明 |
---|---|
user_impersonation | 模拟用户帐户 |
示例
Instances |
Instances |
Instances |
Instances |
Instances |
Instances |
InstancesBatchDeleteByIds
Sample Request
POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/instances/$batch?api-version=2020-07-31
{
"delete": {
"timeSeriesIds": [
[
"2da181d7-8346-4cf2-bd94-a17742237429",
"T1"
],
[
"18672e3d-2beb-4007-9846-042b09ef3c72",
"T2"
]
]
}
}
Sample Response
{
"delete": [
null,
{
"code": "InvalidInput",
"message": "Time series instance with ID '[\"18672e3d-2beb-4007-9846-042b09ef3c72\", \"T2\"]' cannot be deleted. There are already ingested events associated with this time series ID.",
"innerError": {
"code": "CannotDeleteInstance"
}
}
]
}
InstancesBatchDeleteByNames
Sample Request
POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/instances/$batch?api-version=2020-07-31
{
"delete": {
"names": [
"F2W6.GF",
"F1W7.GS1"
]
}
}
Sample Response
{
"delete": [
null,
{
"code": "InvalidInput",
"message": "Time series instance with ID '[\"18672e3d-2beb-4007-9846-042b09ef3c72\", \"T2\"]' cannot be deleted. There are already ingested events associated with this time series ID.",
"innerError": {
"code": "CannotDeleteInstance"
}
}
]
}
InstancesBatchGetByIds
Sample Request
POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/instances/$batch?api-version=2020-07-31
{
"get": {
"timeSeriesIds": [
[
"006dfc2d-0324-4937-998c-d16f3b4f1952",
"T1"
]
]
}
}
Sample Response
{
"get": [
{
"instance": {
"typeId": "9b84e946-7b36-4aa0-9d26-71bf48cb2aff",
"name": "F1W7.GS1",
"timeSeriesId": [
"006dfc2d-0324-4937-998c-d16f3b4f1952",
"T1"
],
"description": "ContosoFarm1W7_GenSpeed1",
"hierarchyIds": [
"33d72529-dd73-4c31-93d8-ae4e6cb5605d"
],
"instanceFields": {
"Name": "GeneratorSpeed",
"Plant": "Contoso Plant 1",
"Unit": "W7",
"System": "Generator System",
"Status": false,
"Version": 1.3,
"Code": 28
}
}
}
]
}
InstancesBatchGetByNames
Sample Request
POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/instances/$batch?api-version=2020-07-31
{
"get": {
"names": [
"F1W7.GS1"
]
}
}
Sample Response
{
"get": [
{
"instance": {
"typeId": "9b84e946-7b36-4aa0-9d26-71bf48cb2aff",
"name": "F1W7.GS1",
"timeSeriesId": [
"006dfc2d-0324-4937-998c-d16f3b4f1952",
"T1"
],
"description": "ContosoFarm1W7_GenSpeed1",
"hierarchyIds": [
"33d72529-dd73-4c31-93d8-ae4e6cb5605d"
],
"instanceFields": {
"Name": "GeneratorSpeed",
"Plant": "Contoso Plant 1",
"Unit": "W7",
"System": "Generator System",
"Status": false,
"Version": 1.3,
"Code": 28
}
}
}
]
}
InstancesBatchPut
Sample Request
POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/instances/$batch?api-version=2020-07-31
{
"put": [
{
"typeId": "9b84e946-7b36-4aa0-9d26-71bf48cb2aff",
"name": "F1W7.GS1",
"timeSeriesId": [
"006dfc2d-0324-4937-998c-d16f3b4f1952",
"T1"
],
"description": "ContosoFarm1W7_GenSpeed1",
"hierarchyIds": [
"33d72529-dd73-4c31-93d8-ae4e6cb5605d"
],
"instanceFields": {
"Name": "GeneratorSpeed",
"Plant": "Contoso Plant 1",
"Unit": "W7",
"System": "Generator System",
"Status": false,
"Version": 1.3,
"Code": 28
}
}
]
}
Sample Response
{
"put": [
{
"error": null
}
]
}
InstancesBatchUpdate
Sample Request
POST https://10000000-0000-0000-0000-100000000109.env.timeseries.azure.com/timeseries/instances/$batch?api-version=2020-07-31
{
"update": [
{
"typeId": "9b84e946-7b36-4aa0-9d26-71bf48cb2aff",
"name": "F1W7.GS1",
"timeSeriesId": [
"006dfc2d-0324-4937-998c-d16f3b4f1952",
"T1"
],
"description": "ContosoFarm1W7_GenSpeed1",
"hierarchyIds": [
"33d72529-dd73-4c31-93d8-ae4e6cb5605d"
],
"instanceFields": {
"Name": "GeneratorSpeed",
"Plant": "Contoso Plant 1",
"Unit": "W7",
"System": "Generator System",
"Status": false,
"Version": 1.3,
"Code": 28
}
}
]
}
Sample Response
{
"update": [
{
"error": null
}
]
}
定义
名称 | 说明 |
---|---|
Instance |
对特定时序实例执行批处理操作的结果。 实例对象在操作成功时设置 (但将操作) 除外,在操作不成功时设置错误对象。 |
Instances |
请求对一批实例执行单个操作。 必须设置“get”、“put”、“update”或“delete”之一。 |
Instances |
对一批实例执行单个操作的响应。 只会根据请求设置“get”、“put”、“update”或“delete”中的一个。 |
Instances |
请求按时序 ID 或时序名称获取或删除实例。 必须设置“timeSeriesIds”或“names”之一。 |
Time |
时序实例是时序本身。 在大多数情况下,deviceId 或 assetId 是环境中资产的唯一标识符。 实例具有与之关联的描述性信息,称为实例字段。 实例字段至少包含层次结构信息。 实例属性还可以包括有用的描述性数据,例如制造商、操作员或上次检修日期。 |
Tsi |
有关 API 错误的信息。 |
Tsi |
包含错误代码和消息的特定 API 错误。 |
Tsi |
其他错误信息。 |
InstanceOrError
对特定时序实例执行批处理操作的结果。 实例对象在操作成功时设置 (但将操作) 除外,在操作不成功时设置错误对象。
名称 | 类型 | 说明 |
---|---|---|
error |
错误对象 - 在操作不成功时设置。 |
|
instance |
时序实例对象 - 在操作成功时设置 (将操作) 除外。 |
InstancesBatchRequest
请求对一批实例执行单个操作。 必须设置“get”、“put”、“update”或“delete”之一。
名称 | 类型 | 说明 |
---|---|---|
delete |
要删除的时序实例。 可以指定时序 ID 或名称。 |
|
get |
要返回的时序 ID 或时序实例的名称。 |
|
put |
要创建或更新的时序实例。 |
|
update |
要更新的时序实例。 如果实例不存在,则返回错误。 |
InstancesBatchResponse
对一批实例执行单个操作的响应。 只会根据请求设置“get”、“put”、“update”或“delete”中的一个。
名称 | 类型 | 说明 |
---|---|---|
delete |
按位置对应于请求中的“delete”数组的错误对象列表。 Null 表示实例已被删除或不存在。 当操作失败 (例如,当有与此时序实例关联的事件) 时,将设置错误对象。 |
|
get |
实例或错误对象列表(按与请求中的“get”数组对应的位置)。 实例对象在操作成功时设置,在操作失败时设置错误对象。 |
|
put |
按位置对应于请求中“put”数组的错误对象列表。 操作不成功时设置错误对象。 |
|
update |
按位置对应于请求中的“update”数组的错误对象列表。 实例对象在操作成功时设置,在操作失败时设置错误对象。 |
InstancesRequestBatchGetOrDelete
请求按时序 ID 或时序名称获取或删除实例。 必须设置“timeSeriesIds”或“names”之一。
名称 | 类型 | 说明 |
---|---|---|
names |
string[] |
要返回或删除的时序实例的名称列表。 |
timeSeriesIds |
Time |
要返回或删除的时序实例的时序 ID 列表。 |
TimeSeriesInstance
时序实例是时序本身。 在大多数情况下,deviceId 或 assetId 是环境中资产的唯一标识符。 实例具有与之关联的描述性信息,称为实例字段。 实例字段至少包含层次结构信息。 实例属性还可以包括有用的描述性数据,例如制造商、操作员或上次检修日期。
名称 | 类型 | 说明 |
---|---|---|
description |
string |
此可选字段包含有关实例的说明。 |
hierarchyIds |
string[] |
实例所属的时序层次结构 ID 集。 可能为 null。 |
instanceFields |
包含用户定义的实例属性的键值对集。 它可以为 null。 支持的属性值类型为:bool、string、long、double,并且不能嵌套或 null。 |
|
name |
string |
在环境中唯一的实例的可选名称。 名称充当时序实例的可变别名或显示名称。 可变,可以为 null。 |
timeSeriesId |
Time |
唯一标识实例的时序 ID。 它与环境中的时序 ID 属性匹配。 不可变,永不为 null。 |
typeId |
string |
这表示此实例所属的类型。 决不会为 null。 |
TsiError
有关 API 错误的信息。
名称 | 类型 | 说明 |
---|---|---|
error |
包含错误代码和消息的特定 API 错误。 |
TsiErrorBody
包含错误代码和消息的特定 API 错误。
名称 | 类型 | 说明 |
---|---|---|
code |
string |
与语言无关、可读的字符串,用于定义特定于服务的错误代码。 此代码用作响应中指定的 HTTP 错误代码的更具体指示符。 可用于以编程方式处理特定错误情况。 |
details |
包含其他错误信息。 可能为 null。 |
|
innerError |
包含更具体的错误,可缩小原因范围。 可能为 null。 |
|
message |
string |
错误的可读、语言无关的表示形式。 它旨在帮助开发人员,不适合向最终用户公开。 |
target |
string |
特定错误的目标 (例如,错误) 中的属性的名称。 可能为 null。 |
TsiErrorDetails
其他错误信息。
名称 | 类型 | 说明 |
---|---|---|
code |
string |
与语言无关、可读的字符串,用于定义特定于服务的错误代码。 此代码用作响应中指定的 HTTP 错误代码的更具体指示符。 可用于以编程方式处理特定错误情况。 |
message |
string |
错误的可读、语言无关的表示形式。 它旨在帮助开发人员,不适合向最终用户公开。 |