on 2024 Apr 12 8:48 PM
Hello experts!
Following the topic read at https://community.sap.com/t5/technology-q-a/sapui5-app-on-cf-gt-xs-app-json-route-destination-in-btp..., development was carried out to consume an API to display order characteristics in a table in a custom Order POD.
The resource spfioriapp-dest-srv was configured in the mta.yaml.
The destination was created in the spfioriapp-dest-srv service.
The destination was added to the xs-app.json.
Example of the AJAX method of type GET in the controller with the URL towards the defined destination.
The MTA is compiled and deployed. And finally, in the generated link of the application when deployed, the data is correctly retrieved.
However, when executed in the Order POD, the call is made from the DM Host and shows a "Not Found".
What is missing or what would be the path for the correct operation of the API within the execution of the Order POD?
Thank you very much in advance.
Best regards.
Request clarification before answering.
It is not possible to make API calls from the plugin with a relative path, as it will use the path of SAP DM, where this destination cannot be found.
For DM own APIs, I would suggest to look into the getPublicApiRestDataSourceUri function from the ProductionComponent.
If you want to call other APIs, there are two possibilites:
You could register them in DM and use them in a production process. Call the production process from the plugin using getPeRestDataSourceUri function.
Or directly call it from the plugin using a BTP destination and the application router. In this case, you cannot use a relative path. The path needs to begin with the absolute path of your plugin application URL, followed by the term from the app router (in your case /sapApi). So something like https://<appURL>/sapApi/order/...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello tobias. Thank you for your answer.
We already tried the absolute route: https://<appURL>/sapApi/order/ but we face CORS issues doing it that way.
What can we do to solve it?
User | Count |
---|---|
3 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.