Skip to Content
1
N K
Mar 24, 2021 at 04:30 AM

SAP Business Application Studio - Multiple Rest API

1101 Views

Hello All,

I am exploring the SAP Business application studio and wondering if there is a way to consume REST based webservices and not oData. I created a Freestyle Fiori SAPUI5 application and trying to make an $.ajax call to the webservice and I was getting the CORS issue. I created the Destination in SCP - Sub account (destination name - myrestapi, url - https://xyz.com) to avoid CORS issues and wanted to use the same in business application studio. Do we need to provide this destination in xs-app.json as I do not see the neo-app.json (that we used to see in web ide)? How do we provide the source, target and destination parameters in the xs-app.json for rest based services? I do not see any documentation regarding that.

        "authenticationType": "none",
        "csrfProtection": false,
        "source":"^(.*)$",
        "destination": "myrestapi"

In the Controller I have the following code - Is the surl invoked correctly or the full url need to be provided?

                var sURL = "/token?grant_type=gettokens";
                $.ajax({
                    type: "POST",
                    url: sURL,
                    dataType: "json",
                    contentType:'application/json',
                    headers: {
                        'Authorization': 'Basic Z1234567890'
                    }
                }).always(function(data, status, response){
                    debugger;
                });

Is there anything that need to be updated in the manifest.json like datasources?

Appreciate any help as I do not see any documentation regarding business application studio consuming 3rd party web services that are not odata.