Skip to Content
Author's profile photo Lukas Brinkmann

Node.js SDK for SAP IoT Application Enablement available on GitHub


SAP IoT Application Enablement is part of the SAP Leonardo Portfolio enabling companies to develop their own IoT applications using a powerful set of business services (application services, Big Data and analytics, developer experience) – in a quick, secure and scalable way [1]. The solution helps you to model digital twins of your real-world object to monitor, track and analyze. One of the main features is the extensive REST-based API providing services to store and retrieve data efficiently for a thing, company and service personel [2].

To make the life of application developers easier, a SDK for SAP IoT Application Enablement is available on GitHub. The SDK provides a NodeJS package that acts a thin wrapper over the API of SAP IoT Application Enablement. The Wrapper abstracts the consumption of the API to fasten your application development for Cloud Foundry [3] providing the following features for now:

  • Abstraction of request handling
  • Performance optimized update of expired OAuth-Tokens [4]
  • Simplify resource-paths definition by setting microservices as base URIs
  • Streaming the API response

The SDK is available open source, free for everyone!

This blog post helps you jump start the application development with the new SDK!


Hands on

In the following hands-on session, we will implement a simple node-application running locally accessing data stored in the Big Data storage of SAP IoT Application Enablement.


  • Node.js development environment [5]
  • A tenant for SAP IoT Application Enablement
  • The OAuth Client Credentials for your tenant (you have received them while onboarding your Application Enablement tenant)


1. Generate a node.js application:

Create a new folder called sdk-demo. Open the command prompt in this folder, execute npm init -f. This initializes your node application. Finally, you should find a file called package.json in your folder.

2. Install the SDK:

Next, we install the SDK for SAP IoT Application Enablement as a dependency of our application. The SDK is published via the public GitHub organization of SAP [6]. You can set the SDK as a dependency to our project by adding the following section to your package.json:

  "dependencies": {
    "iot-application-services-sdk-nodejs": "git+ssh://"

Afterwards, re-open your command prompt and execute npm install. This will install all the dependencies specified in the package.json.

3. Configuration

In next step, we must configure the SDK to access your tenant of SAP IoT Application Enablement. There are three options to configure the SDK:

  1. You can set the necessary variables in your cloud foundry environment,
  2. You can create a file called .env which includes the variable definition in the root of your project and
  3. You can pass a JSON-object to the constructor of the SDK, which includes the variable definitions.

In this tutorial, we will use option 2.) and specify all environment variables in the .env file. So, please create a file called .env and add the following content to the file:

AE_OAUTH_CLIENT_ID = <your client-id goes here>
AE_OAUTH_CLIENT_SECRET = <your client-secret goes here>
AE_TENANT = <your tenant, e.g. ‘sap-iotaeexplore’>

Please make sure, to replace the placeholders (<…>) with the information of your tenant.

4. Usage of the SDK

Now we create the main part of our application, which calls the API of SAP IoT Application Enablement. For this demo purpose, we will request a list of all Things created in our tenant and log the response to the console. The list of all things can be requested via the API endpoint documented in [7].

To access the endpoint, create a file called index.js in the root of your project. Next, copy and paste the following code to this file:

const NodeAE = require('iot-application-services-sdk-nodejs')
const nodeAE = new NodeAE()</code>

// set the base URI for the NodeWrapper
nodeAE.setBaseURI('appiot-mds') // 'appiot-mds' = the app of the API we will use in the following

// now we can use plain http methods to send requests (post, get, put, delete)
const loadingThings = nodeAE.get('/Things')
  function success (oResponse) {
    console.log(JSON.parse(oResponse.body)) // will print all Things on the console
  function error (oError) {
    throw oError

Now you can start the application. Cheers!



This blog post introduced the SDK of SAP IoT Application Enablement and demonstrated the consumption of the API services offered by SAP IoT Application Enablement. But, this is just a starting point! The API offers a broad range of functionalities to consume your data. You can find further documentation about the SDK and some examples here [8].












Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Venu Ravipati
      Venu Ravipati

      Hi Lukas,

      Thank you for the blog.

      I am trying to use the SDK. In Step2, i used below package.json file and did a "npm install". But the dependent module is not getting downloaded.

      "name": "sdk-demo",
      "version": "1.0.0",
      "description": "",
      "main": "index.js",
      "scripts": {
      "test": "echo \"Error: no test specified\" && exit 1"
      "dependencies": {
      "iot-application-services-sdk-nodejs": "git+ssh://"
      "keywords": [],
      "author": "",
      "license": "ISC"


      i am not getting any error as well. just warnings. Below is the log


      >npm install
      npm notice created a lockfile as package-lock.json. You should commit this file.

      npm WARN sdk-demo@1.0.0 No description
      npm WARN sdk-demo@1.0.0 No repository field.

      up to date in 1.821s


      Could you please suggest if i missed anything.

      Thank you in advance,


      Author's profile photo Lukas Brinkmann
      Lukas Brinkmann
      Blog Post Author

      Hi Venu,

      thanks for reporting this issue. I fixed an issue in our package.json file. Your `package.json`-file is working now for me. Could you please try again?

      Best regards,

      Author's profile photo Venu Ravipati
      Venu Ravipati

      Hi Lukas,

      it's working now. Thank you very much.

      Best regards,


      Author's profile photo Fabian Lehmann
      Fabian Lehmann

      Hi Lukas Brinkmann,


      i´ve also just tried out locally it runs without any problem, but if i want to run this "wrapper" on SCP "Cloud Foundry" this did not work.

      Pls check als the GitHub issue for details:

      I thinks the main problem here is the fetching from the host: which looks like an internal SAP host?


      thx and br,


      Author's profile photo Marcus Conrad Behrens
      Marcus Conrad Behrens

      Hi all, I also followed this blog. Any of you starting now might want to rather follow what is in github as those instructions are updated and corrected. Regards, Marcus

      Author's profile photo Jan Reichert
      Jan Reichert

      Hi all,
      We have a great new Node.js SDK for Leonardo IoT available: This means that the SDK described in this blog post is not longer maintained. Please start using the new SDK.