Skip to Content
avatar image
Former Member

How to make use of IoT Application Enablement REST API within own app?

I have a RaspberryPi running Node-RED. I currently have a threshold workflow deployed that reacts to specific sensor values. My question: How can I configure my client to send IoT AE Events via the REST API into my cloud instance?

I do know the syntax of the REST API to create and read events as well as the endpoint. I am able to use Postman for this job. However, the authentification using one's own client is different.

I read the Authorization Guide at the bottom of https://www.sap.com/developer/topics/iot-application-enablement.resources.html#resources .

I also took a look at the SCP Security help page https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/e129aa20c78c4a9fb379b9803b02e5f6.html

Unfortunately, I still don't grasp the concept fully. I assume that I have to incorporate OAuth2.0 into my REST client when sending the message. But how do I that? How do I get the necessary token?

Many thanks in advance and best regards,

Frederik

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Jan 18 at 04:52 PM

    The second option described here https://blogs.sap.com/2017/10/13/access-the-sap-iot-application-enablement-apis-using-postman/ gives more details on fabian's suggestion and this works from anyplace in the Internet. You need the client secret your admin received when the tenant was provided by SAP. I would not put this client secret on a device that is deployed to the field as it allows uncontrolled access to your tenant by anybody.

    Other options:

    1. wait until our ingestion can deal with events or generate events based on measurements
    2. ingest the event as "measurements" and in a batch job on the server convert it to an event object
    3. create a small node app in cf with simpler authentication and from this app create the event
    4. secure your pi so the client secret does not get into the wrong hands
    Add comment
    10|10000 characters needed characters exceeded

  • Jan 18 at 02:50 PM

    Hi Former Member ,

    to get the OAuth token you need to call the UAA from the SAP CP Cloud Foundry Environment by executing the follwing HTTP Post call:

    https://{{tenant_id}}.authentication.eu10.hana.ondemand.com/oauth/token

    hopefully this is what u need.

    br,

    fabian

    Add comment
    10|10000 characters needed characters exceeded