Skip to content

IoT Time Series Bulk Service – 示例

导入批量数据

请使用以下端点从 IoT File Service 导入批量数据:

POST /api/iottsbulk/v3/importJobs

示例请求:

POST /api/iottsbulk/v3/importJobs HTTP/1.1
Host: gateway.eu1.mindsphere.io
Content-Type: application/json
Accept: application/json
Authorization: Bearer {token}
{
  "data": [
    {
      "entity": "my_vehicle_123",
      "propertySetName": "front_left_tire",
      "timeseriesFiles": [
        {
          "filePath": "my_path/my_file_1.json",
          "from": "2018-09-21T15:00:01.787000Z",
          "to": "2018-09-21T15:05:50.633015Z"
        },
        {
          "filePath": "my_path/my_file_2.json",
          "from": "2018-09-21T15:07:00.795015Z",
          "to": "2018-09-21T15:11:40.417015Z"
        }
      ]
    }
  ]
}

验证检查后,服务将返回一个位置消息头及关联的导入作业 ID。

检查导入状态

导入作业 ID 可用于导入状态检查,例如:

GET /api/iottsbulk/v3/importJobs/job123 HTTP/1.1
Host: gateway.eu1.mindsphere.io
Accept: application/json
Authorization: Bearer {token}

示例响应:

[
    {
        "id": "job123",
        "status": "SUBMITTED",
        "message": "{message}",
        "startTime": "2018-11-01T14:48:37.056Z",
        "lastModified": "2018-11-01T14:48:37.056Z"
    }
]

检索批量数据

请使用以下端点从 IoT File Service 检索批量数据:

https://gateway.{region}.{mindsphere-domain}/api/iottsbulk/v3/timeseries/{asset_id}/{aspect_name}

示例请求:

GET /api/iottsbulk/v3/timeseries/my_vehicle_123/front_left_tire?from=2018-11-01T10:00:00.050000Z&to=2018-11-01T10:00:05.000000Z&select=pressure,temperature HTTP/1.1
Host: gateway.eu1.mindsphere.io
Accept: application/json
Authorization: Bearer {token}

示例响应:

{
"records": [
    {
        "pressure": 94,
        "pressure_qc": 192,
        "temperature": 45,
        "_time": "2018-11-01T10:00:00.051035Z"
    },
    {
        "pressure": 95,
        "pressure_qc": 192,
        "temperature": 45,
        "_time": "2018-11-01T10:00:00.052070Z"
    },
    ...
],
"nextRecord": "https://gateway.{region}.mindpshere.io/api/iottsbulk/v3/iottimeseries/my_vehicle_123/front_left_tire?from=2018-11-01T10:00:02.000000Z&to=2018-11-01T10:00:05.000000&select=pressure,temperature"
}

删除批量数据

通过IoT Time Series Service 以下端点删除批量数据:

DELETE /api/iottimeseries/v3/timeseries/{asset_id}{aspect_name}

示例请求:

DELETE /api/iottimeseries/v3/timeseries/my_vehicle_123/front_left_tire?from=2018-11-01T10:00:00Z&to=2018-11-01T11:00:00Z HTTP/1.1
Host: gateway.eu1.mindsphere.io
Accept: application/json
Authorization: Bearer {token}

信息

目前,只能删除间隔小时数为整数的批量数据,且时间范围的开始时间和结束时间必须为整点。


Last update: April 1, 2020