264
Views
4
Comments
Solved
Consume REST API in seprate module and use that API in core module

Hi,

The main issue with REST API.

I have created 2 modules, 1- for core module where all the screens and main db are. 2- for Consuming REST API (GET method) and create server actions. Now the problem is when i want to fetch data at core module using data action I can not take that REST API Response in this core module. What should I do now? 

Thanks in advance.

2022-05-02 13-50-49
Paulo Ritto
Solution

But you will only need that server action, as long as inside that server action you have the API call itself and return the response as an output parameter of that Server Action (the action acts as a wrapper).


Let me know if this helps!

Regards,

Paulo

2022-05-02 13-50-49
Paulo Ritto

Hi @Mosharof

What you should do is in the module where you have your API call, you should wrap that API call in a server action, and set that server action property to Public, so it can be consumed and called in other modules.

Then, in your screen you can call inside the data action, the server action from the other module.
Was I clear enough? Also, I recommend you this link for better understanding of OS architecture canvas, because usually you shouldn't have your front-end and your data model in the same module:

https://success.outsystems.com/Documentation/Best_Practices/Architecture/Designing_the_Architecture_of_Your_OutSystems_Applications/The_Architecture_Canvas


Let me know if this helped,

Paulo

UserImage.jpg
MD MOSHAROF AL AHSAN

Hi,

When i want to create the data action in the screen module the response data type doesn't have that API's response. It shows only the server action in this core module.

2022-05-02 13-50-49
Paulo Ritto
Solution

But you will only need that server action, as long as inside that server action you have the API call itself and return the response as an output parameter of that Server Action (the action acts as a wrapper).


Let me know if this helps!

Regards,

Paulo

2022-07-03 17-24-08
Sourabh sharma

hi 

As Paulo Ritto said follow the correct OS architecture.

Even then you check the data type of DataAction's output, it must be same as your response.

if this can't help plz share the oml 

API

kind regards


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.