cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Call SAP API Business Hub API from a SAPUI5 Application Using BAS

ptw044
Explorer
0 Kudos
2,829

Hi Team,

I am trying consume API from Success Factor in UI application but whenever I run UI5 Application in browser, application is not displaying data .

I have followed below link to consume API from API business hub but in the this document step:10 :.env file is not generating in BAS when we click on Configure Environment option.

https://help.sap.com/viewer/584e0bcbfd4a4aff91c815cefa0bce2d/Cloud/en-US/54ce98a4f9cf454e8b18224623c...

I checked network tab and was getting below error

"Failed to resolve API Key variable request.header.apikey"

Can please tell me where to pass API key in the application and attach developer tutorial link for consuming API from API business hub in the BAS.

Regards

Prakash

View Entire Topic
yuval_morad
Product and Topic Expert
Product and Topic Expert
0 Kudos

1. are you able to test the service in api hub site? maybe you do not have a personal apikey

2. please share the api sandbox destination from the cockpit

3. please share the service editor that you open in service center

ptw044
Explorer
0 Kudos

Hi,

1. I am able to test API in API business Hub-

2.Created two destinations for API business Hub

apihub_sandbox


Description=SAP API Business Hub – Sandbox end point

Type=HTTP

HTML5.DynamicDestination=true

Authentication=NoAuthentication

WebIDEUsage=apihub_sandbox

Name=apihub_sandbox

WebIDEEnabled=true

ProxyType=Internet

URL=https\://sandbox.api.sap.com

SAP_API_Business_Hub

Description=SAP API Business Hub

Type=HTTP

HTML5.DynamicDestination=true

Authentication=NoAuthentication

WebIDEUsage=apihub_catalog

Name=SAP_API_Business_Hub

WebIDEEnabled=true

ProxyType=Internet

URL=https\://api.sap.com

3.Service Centre -> where I create UI5 project

ptw044
Explorer
0 Kudos

Hi yuval.morad

Could please me why "Failed to resolve API Key variable request.header.apikey" error is showing when we are running fiori app?

Regards

IanQuigley
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Prakash,

Can you share details on how you created your Fiori app? Did you use the Fiori generator launched from the Service Centre as Yuval mentions above?

Also, please share details on what command you are using to launch the Fiori app.

Regards,

Ian

zdravko_georgiev
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Prakash,

could you please also share the content of the "ui5.yaml" file of your application.

Best regards,

Zdravko

ptw044
Explorer
0 Kudos

Hi Zdravko,

Please find the below "ui5.yaml" file of my project.

specVersion: "2.5"

metadata:

name: users.usersdemo

type: application

server:

customMiddleware:

- name: fiori-tools-proxy

afterMiddleware: compression

configuration:

ignoreCertError: false # If set to true, certificate errors will be ignored. E.g. self-signed certificates will be accepted

backend:

- apiHub: true

path: /successfactors

url: https://sandbox.api.sap.com

ui5:

path:

- /resources

- /test-resources

url: https://ui5.sap.com

version: '' # The UI5 version, for instance, 1.78.1. Empty string means latest version

- name: fiori-tools-appreload

afterMiddleware: compression

configuration:

port: 35729

path: webapp

delay: 300

- name: fiori-tools-preview

afterMiddleware: fiori-tools-appreload

configuration:

component: users.usersdemo