cancel
Showing results for 
Search instead for 
Did you mean: 

issue with consume external API using with destinations in sap BAS in BTP

Praveen_N
Explorer

Hello All,

Here i am trying to use third party APIs which is related to other SAP systems. initially i tried it to call using ajax calls but i am getting CORS error. so i thought if we use destination to call external APIs may be it will over come CORS issue. so tried to add new destination in BTP.

and i tried to add manually another destination in the 'xs-app.json' file, but i am not able to call that destination in ajax service call.

this is the code added manually in xs-app.json.

{
      "source": "^/(.*)$",
      "target": "/$1",
      "destination": "cpi_system",
      "authenticationType": "xsuaa",
      "csrfProtection": false
    },

here is my ajax call code.

var url = "/cpi_system/EmpDataCloning?SFObject=";
var settings = {
  "async": true,
  "crossDomain": true,
  "url":url
}
$.ajax(settings).done(function (response) {
  console.log(response);
});

but when i run the application this ajax call take origin as my BAS dynamic running app domain.
so for that i could not receive the data from this service call and its throwing CORS error.

can any one please help me with this issue.

Regards,
Praveen

View Entire Topic
0 Kudos

Hi Praveen, Kindly check this related question and the comments under Marius' answer: https://answers.sap.com/questions/13323065/sap-business-application-studio-multiple-rest-api.html

Regards, Merlin