58
Views
20
Comments
Refresh REST api
Question
Application Type
Reactive

Hello,

I have fetched data via a REST API, specifically profiles from another website, and processed this data into a table. This part works fine. Now, I want to ensure that when I create a new profile or update an existing profile on the website, these changes are automatically reflected in my application. I have tried various approaches, but I can't seem to get it to work. What am I missing? How can I ensure that the table automatically shows the updated data?

Thank you in advance!

2019-01-07 16-04-16
Siya
 
MVP

One option to consider is exposing a REST endpoint on your website so that when the other site updates or creates a profile, they can notify you. This way, you can retrieve the updated data from the other site and update your table. This is only possible if you can modify the other site to invoke your API. 

By the way, what approaches have you tried so far, and what challenges are you facing?

2025-10-04 10-47-11
David Castro

Hi @Siya, thanks for the response. I just have a GET URL, i can't change anything on the other site. 
I looked on the forum to find some solution, and find server actions to call the API again and also client actions etc. 

I also just removed the API and start over again, but then i also get the old items. So i don't know what i'm doing wrong. 



2019-01-07 16-04-16
Siya
 
MVP

As I understand from your response to @Nawaz Khan, your requirement is to fetch the data using an API only when an Admin access a particular screen. You can use Data Action, as suggested by @Nawaz Khan, to fetch the data and update the entity. Regarding your question about Swagger, can you consume the API in a test application to see the exact issue?

2019-04-09 00-57-55
carl ruhle

Fully agree with Siya, I think that is the best option available. 

2024-06-08 15-17-54
Nawaz Khan

if the solution which @Siya  suggested not fit as per your requirement due to not having control over the other party to consume your API to notify you when change occurs in profile then my opinion you have the timers option which can check periodically and update your table.

2025-10-04 10-47-11
David Castro

Hi @Nawaz KhanAlso thanks for the reply with a solution, and yes i can't change anything. Is there no option, that on 'OnInitialize' there will be a API call to refresh? 



2024-06-08 15-17-54
Nawaz Khan

@David Castro yes you can use the DataAction of page instead oninitialize client action and get the logged in user detail and update in your DB. More appropriate use will be when user login first time and if login successful then you should call the API to update the user record. Please note that this case is suitable if the API you are consuming can respond you with data as per the logged in user while if consumed API is returning the list of all users regardless of current user(assuming the API cannot return single user) then timer is the best option to update automatically without any user interaction.

Hope this will help

2025-10-04 10-47-11
David Castro

@Nawaz Khan thanks again for the reply.  

The data in question is a list that does not need to be user-specific. The main requirement is that when the "admin" logs in to manage this data, they should immediately see an updated table.

I recently tried to manually refresh the API, but I received the following error message: "We weren’t able to import the Swagger file since it doesn’t follow a supported specification."

Am I doing something wrong?

2024-05-20 09-45-12
Jean Bastos

Hi David,
Can you share the OML. It Will be more productive to help.

About the swagger... How did you first get this endpoint?

2024-06-08 15-17-54
Nawaz Khan

@David Castro most probably the API you refreshed was added as single method which does not required Swagger specification and you can define the request and response objects as per the API specification. It might be due to the API you consumed does not have the Swagger documentation. Unlike Outsystems, any other platform like .NET, swagger specification required to add separately and may not be available. 

you can check how to add the API as per the swagger specification here


2025-10-04 10-47-11
David Castro

Hi @Jean Bastos

Yes i will upload it now,  i removed the actions i tried. 

Testapp.oml
2024-07-16 17-36-51
Shradha Rawlani

Hello,

You can call your API in data action to get updated record


Regards

Shradha

2025-10-04 10-47-11
David Castro

Hi @Shradha Rawlani

Thanks for the reply, can you explain this?  

Kind regards, 

David 

2024-07-16 17-36-51
Shradha Rawlani

Hi David,

Sure, 

  • call your API on Data action to get records for table
  • In Save or update action of profile at the end call refresh data action it will again call API and get updated records

It will give you updated record based on updated

Regards

Shradha

2025-10-04 10-47-11
David Castro

Hi @Shradha Rawlani

I don't have the possibility to modify the API after Save of Update.  

Thanks, 

2024-07-16 17-36-51
Shradha Rawlani

Hi David

Records that are updated or created are stored in Database or update the API by API update action?

2024-06-08 15-17-54
Nawaz Khan

@David Castro, there must be some parameters which you must be using to filter the specific record (DOB, Civil Number, License number, Passport number etc) in order to update in your DB after getting the record from the API. 

As per you attached .oml file, It seems you do not have any relation between the users and the API response if I am not wrong. First please define the relation DB users and API response and that relation will identify the record required to update in your DB. 




2025-10-04 10-47-11
David Castro

Hi @Nawaz Khan, thanks for the respond. 

The only link i get from the GET is the one you can see in the file. So so you think i cant get the table updated? 

2024-06-08 15-17-54
Nawaz Khan

@David Castro I think no, you can't update your DB.

Only  way is if you have some identical fields in your DB and in API to match the record to update.

2025-10-04 10-47-11
David Castro

Hi @Nawaz Khan

The thing is, sometimes when i made a change in de other website on a profile, i see the updates in outsytems and then i try to do more i don't. 

The fields are identical, i imported the GET and insert the fields from out the structure in outsystems. 

I dont understand why some are working and some not.  I insert all the info in the form on the other website and some i showing in Outsystems table like the screenshot and some not. 

This is just a try out, i can only start building the app when this works instant, i just don't get it. 

Scherm­afbeelding 2024-07-05 om 13.03.43.png
Scherm­afbeelding 2024-07-05 om 13.10.05.png
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.