cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

Hi Experts,

We have a requirement to consume a REST API in an SAPUI5 application developed in SAP Business Application Studio (BAS). I am able to consume ODATA service but for a REST API getting HTTP 404 error code, can you all please look at below scenario and help if I am missing out something. This is now on high priority any sort of help would be much appreciated.

Please note below:

I have create a FIORI app in SAP BAS having Target Runtime as Cloud Foundry and Using MANAGED APPROUTER, app id in manifest is ns.zzidexx2

Create a destination name "jsonplaceholder" in subaccount

Modified xs-app.json to include a route for redirection of API calls to destination

calling the REST API in view controller along with destination name

Tested the destination "jsonplaceholder" from BAS, it is working fine

-Regards,
Rauf Shaikh

View Entire Topic
jlong
Product and Topic Expert
Product and Topic Expert
0 Likes

Couple of things;

When running on Business Application studio, ensure the path in the ui5.yaml | ui5-local.yaml is defined as follows;

        backend:
          - path: /jsonplaceholder           
            url: "https://jsonplaceholder.typicode.com/"
            destination: jsonplaceholder

If running on mac or windows, then the URL is read and not the destination since this flow is only supported on BAS.

Also, update your destination configuration properties from odata_abap to odata_json. This is not an ABAP backend which normally exposes catalogs of services.

Please update your curl command to the following, appending the https protocol

curl -v https://jsonplaceholder.dest/jsonplaceholder/posts

If all this works, then the xs-app.json you already have defined should handle the routing when deployed to CF.

John

dibyodeo
Explorer
0 Likes

Hello John ,

I had similar kind of issues. Can you please give me some points where i did wrong .

manifest.json

"Cleartext": { "dataSource": "Cleartext" }xsapp.json { "source": "^/Cleartext/(.*)$", "target": "/$1", "destination": "Cleartext", "authenticationType": "none", "csrfProtection": false },UI5.yml backend: - path: /sap url: https://xyz.com destination: S4HDEV_DEST_S4CLOUD - path: /Cleartext url: "https://api-sandbox.clear.in/einv" destination: CleartextStill it is giving me 404 error .Can you provide some input.BRDD
jlong
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi,

Your destination is configured as a full URL destination i.e. the URL defined should have the full path to the OData XML service. However, if you open a browser tab and hit https://api-sandbox.clear.in/einv this returns 404. So the 404 issue is unrelated to destination configuration, you need to debug why your endpoint is returning this HTTP status.

In your xs-app.json and your ui5.yaml your settings look correct. The issue is with the URL endpoint not exposing a service but instead returning 404.

Refer to Guided Answers for more debugging around full url destinations

https://ga.support.sap.com/dtp/viewer/index.html#/tree/3046/actions/45995:48363:53594:48366:51208

John