Skip to Content
Technical Articles

Simplify the consuming of external APIs in NodeJS and the Cloud Application Programming Model

There are already great node.js libraries you can use to call APIs like jowavp/sap-cf-destconn that wraps the node.js HTTP calls that use sap cloud platform destination and connectivity services, or jcailan/cdse, a CDS extension that simplifies to an APIs for basic and none authentication API.

The SAP Devtoberfest 2020 challenge brought new insights to simplify the consuming external API in NodeJS and the Cloud Application Programming (CAP) Model and combine them with a concept for integrating Microsoft Azure and Google Cloud APIs.

As a result, the SAP Mentors community provides a new node.js library called sapmentors/CDS-SCP-API. A library. that simplifies the consuming of external API from SAP On-Premise & Cloud APIs, Microsoft Office 365 APIs, Google Cloud Platform APIs, and other REST APIs in standalone and SAP Cloud Application Programming (CAP) Model node.js applications on the SAP Cloud Platform.

Just with the strength of the SAP Cloud Platform and three lines of code, you will get your data from any API:

// Load the module
const cdsapi = require("@sapmentors/cds-scp-api");

// Create a connection
const service = await cdsapi.connect.to("SCPDestination");

// Request the API
let result = await service.run({
                                   url: "/pathOfService"
                               })

The CDS-SCP-API node.js library is well documented on its GitHub page with many configurations and code examples.

Enjoy the use of this node.js library. We hope it will make SAP developers’ lives better.

 

Be the first to leave a comment
You must be Logged on to comment or reply to a post.