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:

1
POST /api/iottsbulk/v3/importJobs

Sample request:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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.:

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

Sample response:

1
2
3
4
5
6
7
8
9
[
    {
        "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:

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

Sample request:

1
2
3
4
GET /api/iottsbulk/v3/iottimeseries/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:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
{
"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:

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

Sample request:

1
2
3
4
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.

Any questions left?

Ask the community


Except where otherwise noted, content on this site is licensed under the MindSphere Development License Agreement.