Showing results for 
Search instead for 
Did you mean: 

Consumption of an API within a Custom POD Plugin in SAP DMC


Hello experts!

Following the topic read at, 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.

imagen (1).png

The destination was added to the xs-app.json.

imagen (2).png

Example of the AJAX method of type GET in the controller with the URL towards the defined destination.

imagen (3).png

The MTA is compiled and deployed. And finally, in the generated link of the application when deployed, the data is correctly retrieved.

imagen (4).png

However, when executed in the Order POD, the call is made from the DM Host and shows a "Not Found".

imagen (5).png

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.


View Entire Topic

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/...


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?

Add the route from the app router (sapApi in your case) to the CORS section in the mta.yaml file