What is the best appraoch to call two api one after another in outsystems 10 web??

Requirements :

I have a functionality like i want to call two APi but ,second api call only after first api response is come?


Regards,

Viru

Hi Viru 7,


I would create a user action with the two calls inside, one after the other.


Hope this help.

Hi Nuno,

Thanks for your reply.I was tried but nothing works for me.



Regards

Viru

Hi Viru,

Can you share the sample oml?

It must be pretty simple, you can check the response of first API and if its 200/OK, then you can the second API in the same flow.

Regards,

Manish Jawla

Hi Manish,


As you can see in below image I was using two API calls 

1) PostCommetnsSocial

 2)GetCommentList2.

Now the thing is second api (GetCommentList2) is call before Post operation(PostCommetnsSocial) is completed that because newly added comment is not reflected on page.


So i want to do async call like second api is not call until the First api operation is not completed.



Regards,

Viru

I don't think the calls run asynchronously.

Because you can have a REST call that has an output and use it on later calls with no issues.

It might be that the API that you are consuming does not save the comment before it saves it to the DB. Might be that they are adding it to a queue and return a 200 Status Code to you immediately. 

If this is the case now you are dealing with problems with eventual consistency.

What API are you trying to consume?

Andres Moreno