Skip to content

IoT Time Series Bulk Service – Samples

Importing Bulk Data

To import bulk data from the IoT File Service, use the following endpoint:

POST /api/iottsbulk/v3/importJobs

Sample request:

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"
        }
      ]
    }
  ]
}

After validation checks, the service returns a location header with the associated import job ID.

Checking the Import Status

The import job ID can be used for import status checks, e.g.:

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

Sample response:

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

Retrieving Bulk Data

To retrieve bulk data from the IoT File Service, use the following endpoint:

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

Sample request:

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}

Sample response:

{
"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"
}

Deleting Bulk Data

Bulk data is deleted using the IoT Time Series Service via the following endpoint:

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

Sample request:

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}

Info

Currently, only full hours of bulk data can be deleted and the time range must start and end at the top of an hour.

Community

Connect and Collaborate with Industrial Professionals and Join the Community!

Click to load comments