This example uses APIs of the SAP Gateway Demo System ES5. If you don't have access to the SAP Gateway Demo System ES5, you can follow this tutorial to get access.
- Retrieve a product list from public available SAP OData service - Standalone Node.js/Javascript Example
- Create a product with public available SAP OData service - Standalone Node.js/Javascript Example
const cdsapi = require("@sapmentors/cds-scp-api");
async function InternetAPIGetRequestwithBasicAuthentication() {
const service = await cdsapi.connect.to("ES5");
return await service.run({
url: "/sap/opu/odata/sap/EPM_REF_APPS_SHOP_SRV/Products?$top=2"
})
}
InternetAPIGetRequestwithBasicAuthentication()
.then((data) => {
console.log(data.d.results[0].Name)
})
'Notebook Basic 15'