Skip to Content
0

SAP IoT AE API for list of things with data

Mar 09 at 06:47 PM

82

avatar image
Former Member

Hi team,

Working on an AE app, I need an api providing details (basic data, latest time series data) of all the things from one package (or at least from the same thing type).

I found an API providing details for one thing: /appiot-mds/Snapshot(thingId='<thing_id>',fromTime='',dataCategory='')

I also found one to get all things from one thing type, but this one gives only some generic data about the things (id, description, name, etc). I would also need their basic data from the thing property catalog and their latest time series data (similar to what provide the first API): /appiot-mds/Things?$filter=_thingType eq '<thing_type>'...

Do you know if such an api exists? (a combination of the two described above)
This would allow us to create a simple view of all the different things from the same thing type/package, including some data other than name, id,etc

Thanks,
Joris

API
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Marcus Behrens
Mar 12 at 01:20 PM
1

I suggest you try the advanced thing list api described at https://help.sap.com/viewer/350cb3262cb8496b9f5e9e8b039b52db/latest/en-US/c969a7b0927d4a9da787570d79e761e8.html

Here is one example based on the tutorial and the limited trial we have offered at developer.sap.com > iot application enablement:

GET /advancedlist-thing-sap/CompositeThings/v1/Things?$expand=DYN_ENT_sap_iotaehandson2_computeriotdevice__Default%2cDYN_ENT_sap_iotaehandson2_computeriotdevice__resource_sensors_2&$format=json HTTP/1.1
Host: sap-iotaehandson2.iot-sap.cfapps.eu10.hana.ondemand.com
Content-Type: application/json
sap-iot-pst: sap.iotaehandson2.computeriotdevice:Default,sap.iotaehandson2.computeriotdevice:resource_sensors_2

returns the folowing (abbreviated). As you can see multiple things and both master data and measurements:

{
    "d": {
        "results": [
            {
                "__metadata": {
                    "id": "https://sap-iotaehandson2.iot-sap.cfapps.eu10.hana.ondemand.com/advancedlist-thing-sap/CompositeThings/v1/Things('0079945DCD0A46EA959FC0ADCF435365')",
                    "uri": "https://sap-iotaehandson2.iot-sap.cfapps.eu10.hana.ondemand.com/advancedlist-thing-sap/CompositeThings/v1/Things('0079945DCD0A46EA959FC0ADCF435365')",
                    "type": "com.sap.appiot.Thing"
                },
                "ThingId": "0079945DCD0A46EA959FC0ADCF435365",
                "ISOCode": "en",
                "ThingDescription": "Vk001",
                "ThingName": "Vk001",
                "ThingExternalId": "Vk001",
                "ThingType": "sap.iotaehandson2.computeriotdevice:generic_computer",
                "ObjectGroup": "C6484A9DC2274E4A87BCED73AAEA8650",
                "BusinessPartnerName": null,
                "BPLandlinePhoneNumber": null,
                "BPMobilePhoneNumber": null,
                "ThingCustomerId": null,
                "ThingRegionDescription": null,
                "ThingCountryDescription": null,
                "ThingCountryId": null,
                "ThingCommunicationData": null,
                "ThingLocationId": null,
                "Latitude": null,
                "Longitude": null,
                "DYN_ENT_sap_iotaehandson2_computeriotdevice__Default": {
                    "ThingId": "0079945DCD0A46EA959FC0ADCF435365",
                    "Default.common_name": "Vinayak-001",
                    "Default.common_name.Timestamp": "/Date(1520247077000)/"
                },
                "HierarchyElements": {
                    "__deferred": {
                        "uri": "https://sap-iotaehandson2.iot-sap.cfapps.eu10.hana.ondemand.com/advancedlist-thing-sap/CompositeThings/v1/Things('0079945DCD0A46EA959FC0ADCF435365')/HierarchyElements"
                    }
                },
                "DYN_ENT_sap_iotaehandson2_computeriotdevice__resource_sensors_2": {
                    "ThingId": "0079945DCD0A46EA959FC0ADCF435365",
                    "resource_sensors_2.cpu_type": null,
                    "resource_sensors_2.cpu_type.Timestamp": null,
                    "resource_sensors_2.cpu_usage": null,
                    "resource_sensors_2.cpu_usage.UpperThreshold88882": "45.0",
                    "resource_sensors_2.cpu_usage.UoM82586": null,
                    "resource_sensors_2.cpu_usage.UpperUpperThreshold65329": "90.0",
                    "resource_sensors_2.cpu_usage.Timestamp": null,
                    "resource_sensors_2.cpu_usage.UpperUpperThreshold65329.Timestamp": "/Date(1520247146000)/",
                    "resource_sensors_2.cpu_usage.UoM82586.Timestamp": "/Date(1520247146000)/",
                    "resource_sensors_2.cpu_usage.UpperThreshold88882.Timestamp": "/Date(1520247146000)/"
                }
            },
            {
                "__metadata": {
                    "id": "https://sap-iotaehandson2.iot-sap.cfapps.eu10.hana.ondemand.com/advancedlist-thing-sap/CompositeThings/v1/Things('012D2C6443E642C294B116EE76E57FA4')",
                    "uri": "https://sap-iotaehandson2.iot-sap.cfapps.eu10.hana.ondemand.com/advancedlist-thing-sap/CompositeThings/v1/Things('012D2C6443E642C294B116EE76E57FA4')",
                    "type": "com.sap.appiot.Thing"
                },
                "ThingId": "012D2C6443E642C294B116EE76E57FA4",
                "ISOCode": "en",
                "ThingDescription": "Edwin's Computer",
                "ThingName": "computer_P001298_2",
                "ThingExternalId": "computer_P001298_2",
                "ThingType": "sap.iotaehandson2.computeriotdevice:generic_computer",
                "ObjectGroup": "C6484A9DC2274E4A87BCED73AAEA8650",
                "BusinessPartnerName": null,
                "BPLandlinePhoneNumber": null,
                "BPMobilePhoneNumber": null,
                "ThingCustomerId": null,
                "ThingRegionDescription": null,
                "ThingCountryDescription": null,
                "ThingCountryId": null,
                "ThingCommunicationData": null,
                "ThingLocationId": null,
                "Latitude": null,
                "Longitude": null,
                "DYN_ENT_sap_iotaehandson2_computeriotdevice__Default": {
                    "ThingId": "012D2C6443E642C294B116EE76E57FA4",
                    "Default.common_name": "WDFN31644964A",
                    "Default.common_name.Timestamp": "/Date(1519310067000)/"
                },
                "HierarchyElements": {
                    "__deferred": {
                        "uri": "https://sap-iotaehandson2.iot-sap.cfapps.eu10.hana.ondemand.com/advancedlist-thing-sap/CompositeThings/v1/Things('012D2C6443E642C294B116EE76E57FA4')/HierarchyElements"
                    }
                },
                "DYN_ENT_sap_iotaehandson2_computeriotdevice__resource_sensors_2": {
                    "ThingId": "012D2C6443E642C294B116EE76E57FA4",
                    "resource_sensors_2.cpu_type": "generic",
                    "resource_sensors_2.cpu_type.Timestamp": "/Date(1519862400000)/",
                    "resource_sensors_2.cpu_usage": "10.9",
                    "resource_sensors_2.cpu_usage.UpperThreshold88882": "45.0",
                    "resource_sensors_2.cpu_usage.UoM82586": null,
                    "resource_sensors_2.cpu_usage.UpperUpperThreshold65329": "90.0",
                    "resource_sensors_2.cpu_usage.Timestamp": "/Date(1519312068000)/",
                    "resource_sensors_2.cpu_usage.UpperUpperThreshold65329.Timestamp": "/Date(1519310067000)/",
                    "resource_sensors_2.cpu_usage.UoM82586.Timestamp": "/Date(1519310067000)/",
                    "resource_sensors_2.cpu_usage.UpperThreshold88882.Timestamp": "/Date(1519310067000)/"
                }
            },
            {
                "__metadata": {
                    "id": "https://sap-iotaehandson2.iot-sap.cfapps.eu10.hana.ondemand.com/advancedlist-thing-sap/CompositeThings/v1/Things('01BD28E868964B189E00700D5AABA7C3')",
                    "uri": "https://sap-iotaehandson2.iot-sap.cfapps.eu10.hana.ondemand.com/advancedlist-thing-sap/CompositeThings/v1/Things('01BD28E868964B189E00700D5AABA7C3')",
                    "type": "com.sap.appiot.Thing"
                },
                "ThingId": "01BD28E868964B189E00700D5AABA7C3",
                "ISOCode": "en",
                "ThingDescription": "KPMG Computer",
                "ThingName": "Roopa_Computer",
                "ThingExternalId": "Roopa_Computer",
                "ThingType": "sap.iotaehandson2.computeriotdevice:generic_computer",
                "ObjectGroup": "C6484A9DC2274E4A87BCED73AAEA8650",
                "BusinessPartnerName": null,
Share
10 |10000 characters needed characters left characters exceeded