cancel
Showing results for 
Search instead for 
Did you mean: 

How to call API Trigger( SAP Build Process Automation ) directly?

sbslmhmt
Participant
841

Hello,

I am trying to call API trigger direcly from SAPUI5 application. I am getting the token correctly. I am sure my json is correct. When I try to make same call from postman its working. Could anyone tell me what I am doing wrong?

Here is the ajax call I make:

var vToken = "Bearer " + oToken; $.ajax({ url: "https://spa-api-gateway-bpi-eu-prod.cfapps.eu10.hana.ondemand.com/workflow/rest/v1/workflow-instances", contentType: "application/json", type: "POST", data: JSON.stringify(oJson), success: function (oData, oResponse) { debugger; }.bind(this), error: function (oError,oErrorMessage) { debugger; }, beforeSend: function (xhr) { xhr.setRequestHeader("Authorization", vToken); }
});

Here is the response( doesn't say much 😞

Also throws this error on console:

Accepted Solutions (0)

Answers (1)

Answers (1)

shobhit2108
Explorer

Hi Mehmet,

I think the CORS issue is coming up because you are hardcoding the whole URL in the application.

You need to create a destination for this service endpoint in the SAP BTP account, then call this destination from your SAPUI5 application.

This will resolve your issue.

In case you are totally new to this concept, I would suggest you read out destination connectivity concept for SAPUI5 and SAP BTP. It will provide you a great insight on the connectivity mechanism to external API's for SAPUI5 apps.

Thanks

Shobhit Pathak