Read Thing Hierarchy Elements

With this method, you can retrieve thing hierarchy elements for a specific thing hierarchy ID.

By default, the service displays a maximum of 100 records per response. You can navigate to the next set of results, if available, using the __next link at the end in the response payload. However, the number of records retrieved depends on the query parameter $top, if provided in the request URL. For more information, see Retrieving List of Records.

Request

URI: /CompositesThingHierarchy/v1/Hierarchies(‘<thing hierarchy ID>’)/ThingHierarchyElements

Operation Type: CRUD

HTTP Method: GET

Permissions: <ctodata>.r

Request Parameters

Parameter Required Data Type Description
HierarchyId Yes String Unique thing hierarchy identifier
Parameter Required Data Type Description
$top No Integer Number of records to include in the result set. Default value is 20.
$skip No Integer Number of the first n records to be excluded from the result set. Default value is 20.
$orderby No String Field name to be used for sorting the result set in ascending order; valid fields are HierarchyId, ThingId, ThingName, ThingType, ParentThing, and ParentThingName. To sort the result set, use asc for the ascending order and desc for the descending order.
$filter No String Filter condition to be applied; valid fields are HierarchyId, ThingId, ThingName, ThingType, ParentThing, and ParentThingName. The filter operators supported are eq, lt, gt, le, ge, and ne. Multiple filters are supported using the AND separator. Only valid field is property set type name.
$select No String Select condition for the data fields to be included in the result set; valid fields are HierarchyId, ThingId, ThingName, ThingType, ParentThing, and ParentThingName.

Request Example

/CompositesThingHierarchy/v1/Hierarchies('E90000901EDA39E31500ED02BBE5CEF0')/ThingHierarchyElements

Retrieves thing hierarchy elements for the specified thing hierarchy ID E90000901EDA39E31500ED02BBE5CEF0.

You can also use the query parameter $expand to retrieve thing hierarchy elements for the specified thing hierarchy ID. However, you cannot use query parameters $top, $skip, $orderby, and $selelct along with $expand.

/CompositesThingHierarchy/v1/Hierarchies('E90000901EDA39E31500ED02BBE5CEF0')?$expand=ThingHierarchyElements

Response

Response Status and Error Codes

Code Description
200 Data retrieved successfully.

Payload

Format: JSON

Media types supported are JSON and XML. The JSON for this method has the structure as depicted in the following examples:

Example 1

/CompositesThingHierarchy/v1/Hierarchies('E90000901EDA39E31500ED02BBE5CEF0')/ThingHierarchyElements

{
    "d": {
        "results": [
            {
                "__metadata": {
                    "id": "https://cs-hierarchy-meta-sap-perf.cfapps.sap.hana.ondemand.com:443/CompositesThingHierarchy/v1/ThingHierarchyElements('E90000901EDA39E31500ED02BBE5CEF0')",
                    "uri": "https://cs-hierarchy-meta-sap-perf.cfapps.sap.hana.ondemand.com:443/CompositesThingHierarchy/v1/ThingHierarchyElements('E90000901EDA39E31500ED02BBE5CEF0')",
                    "type": "com.sap.appiot.hierarchymeta.ThingHierarchyElements"
                },
                "HierarchyId": "E90000901EDA39E31500ED02BBE5CEF0",
                "ThingId": "07DA3C0D259242248FDCF15413552D76",
                "ThingName": "Component Hierarchy for Baseplate_000505",
                "ThingDescription": "Baseplate 000505",
                "ParentThing": "",
                "ParentThingName": "",
                "ParentThingDescription": "",
                "PropertySetTypes": {
                    "__deferred": {
                        "uri": "https://cs-hierarchy-meta-sap-perf.cfapps.sap.hana.ondemand.com:443/CompositesThingHierarchy/v1/ThingHierarchyElements('E90000901EDA39E31500ED02BBE5CEF0')/PropertySetTypes"
                    }
                }
            }
        ]
    }
}

Example 2

/CompositesThingHierarchy/v1/Hierarchies('E90000901EDA39E31500ED02BBE5CEF0')?$expand=ThingHierarchyElements

{
    "d": {
        "__metadata": {
            "id": "https://cs-hierarchy-meta-sap-perf.cfapps.sap.hana.ondemand.com:443/CompositesThingHierarchy/v1/Hierarchies('E90000901EDA39E31500ED02BBE5CEF0')",
            "uri": "https://cs-hierarchy-meta-sap-perf.cfapps.sap.hana.ondemand.com:443/CompositesThingHierarchy/v1/Hierarchies('E90000901EDA39E31500ED02BBE5CEF0')",
            "type": "com.sap.appiot.hierarchymeta.Hierarchies"
        },
        "HierarchyId": "E90000901EDA39E31500ED02BBE5CEF0",
        "HierarchyName": "H_Baseplate_000505",
        "HierarchyDescription": "Component Hierarchy for Baseplate_000505",
        "HierarchyExternalId": "H_Baseplate_000505",
        "ISOCode": "en",
        "ThingHierarchyElements": {
            "results": [
                {
                    "HierarchyId": "E90000901EDA39E31500ED02BBE5CEF0",
                    "ThingId": "07DA3C0D259242248FDCF15413552D76",
                    "ThingName": "Baseplate_000505",
                    "ThingDescription": "Baseplate 000505",
                    "ParentThing": "",
                    "ParentThingName": "",
                    "ParentThingDescription": ""
                }
            ]
        }
    }
}