Read a Segment

Read a data segment.

With this service method, you can retrieve the segment with the specified ID. The ID is automatically assigned to a segment upon creation. It’s a string made up of 36 characters.

For a closed segment, you can optionally specify a property set type used by a thing related to the segment. The response payload then returns aggregates for the measured values that have been recorded for the various properties of the property set type.

Request

URI: /v1/segments/<segment ID>

HTTP Method: GET

Permissions: seg.r

Request Headers

Header Required Values
Authorization Yes Bearer Token.
sap-iot-thingpst No Name of a property set type for which aggregate values shall be returned.

Request Parameters

Parameter Required Data Type Description Parameter Type
segment ID Yes string Unique ID of the data segment. Path

Request Example

/v1/segments/1acd182d-1323-4f57-8eec-8f3bd17e3c22

Response

Response Status and Error Codes

Code Description
200 Segment retrieved successfully.
401 Unauthorized.
403 Forbidden.
404 Not found.

Response Example

{
  "id": "1acd182d-1323-4f57-8eec-8f3bd17e3c22",
  "ETag": "8cbfee81bbcbd7097bb09347c8b7c04a",
  "startTime": "2020-05-07T12:01:39.134Z",
  "endTime": "2020-05-07T12:01:39.134Z",
  "thingModel": {
    "thingId": "MyThingID",
    "thingTypeId": "segments.sandbox02.segments:integrationTestTT_6",
    "version": "3"
  },
  "tags": [
    "tag_a",
    "tag_b",
    "tag_c"
  ],
  "state": "HARDENED",
  "type": {
    "name": "rule-based"
  },
  "sensitivityLevel": "com.sap.appiot.security:pii",
  "createdOn": "2020-05-07T12:01:39.134Z",
  "aggregates": [{
        "fill_level_SUM": "702.0",
        "fill_level_TMAX": "2021-02-17T09:03:47.784+00:00",
        "fill_level_FIRST": 90,
        "fill_level_TLAST": "2021-02-17T09:07:44.157+00:00",
        "fill_level_MIN": 18,
        "fill_level_AVG": "54.0",
        "fill_level_LAST": 18,
        "fill_level_COUNT": "13",
        "fill_level_STDDEV": "22.44994432064365",
        "fill_level_TMIN": "2021-02-17T09:07:44.157+00:00",
        "fill_level_PERCENT_GOOD": "100.0",
        "fill_level_MAX": 90,
        "fill_level_TFIRST": "2021-02-17T09:03:47.784+00:00"
        }
  ]
}

This example shows the response payload for a rule-based segment. That is, a segment that was automatically created by the rules that are assigned to a recognition configuration along with the thing type listed in the response. The trailing <aggregates> array in the payload contains the aggregated measured values recorded for the property set type specified by the sap-iot-thingpst header parameter. Note that the aggregates are only returned for a closed segment (that is, "state": "HARDENED").