Call RestAPI based on value retrieved from a previous call

Hi guys,


First off, hope everyone is safe and healthy.

I am working on a reactive prototype.

I have a question regarding making a call to a RestAPI endpoint using an ID that is retrieved from a previous call from another RestAPI endpoint.

Example:

Get API 1

Response

ID

Name


Get API 2/{ID}

I am getting all the time an Invalid Data Dependency error, once I try to add as input the response attribute from the other API call.


I have checked the tutorials but none show how to make cascading calls.



Restore the first API response in separate variable and then pass the input to 2nd API.

Another thing to observe, the data type of the input value - Do convert ID to Input value data type

Vani Mankad wrote:

Restore the first API response in separate variable and then pass the input to 2nd API.

Another thing to observe, the data type of the input value - Do convert ID to Input value data type

Hi Vani


Thanks. I am passing the response to a local variable list.

Now, I have trying to iterate the list with for each, but I am getting lost.Can you assist?


Hi,

Please share an oml with the problem. I can have a look.


Thanks

cpinho wrote:

Vani Mankad wrote:

Restore the first API response in separate variable and then pass the input to 2nd API.

Another thing to observe, the data type of the input value - Do convert ID to Input value data type

Hi Vani


Thanks. I am passing the response to a local variable list.

Now, I have trying to iterate the list with for each, but I am getting lost.Can you assist?


Hi,



Create action and call first rest API in that based on that output you can apply ur logic and next line call the second endpoint and pass that value.


cpinho wrote:

Hi guys,


First off, hope everyone is safe and healthy.

I am working on a reactive prototype.

I have a question regarding making a call to a RestAPI endpoint using an ID that is retrieved from a previous call from another RestAPI endpoint.

Example:

Get API 1

Response

ID

Name


Get API 2/{ID}

I am getting all the time an Invalid Data Dependency error, once I try to add as input the response attribute from the other API call.


I have checked the tutorials but none show how to make cascading calls.



The response for the first API is the same type of input from the second one?

Can you take a print from the flow and input response from both APIs?


Best regards


Vani Mankad wrote:

Hi,

Please share an oml with the problem. I can have a look.


Thanks

Agree with Vani, need more details to understand problem. If you can share OML or at-least API (if they are general API) to understand their structure will help to provide input/solution.


Solution

cpinho wrote:

Vani Mankad wrote:

Restore the first API response in separate variable and then pass the input to 2nd API.

Another thing to observe, the data type of the input value - Do convert ID to Input value data type

Hi Vani


Thanks. I am passing the response to a local variable list.

Now, I have trying to iterate the list with for each, but I am getting lost.Can you assist?


Hi if I'm not wrong and you are saving the response from the first api to a local list, your second api is being executed with the default values from your local variable, what I mean is that the 2 API will be executed before the end of the first, will just wait if you use direct the response as input parameter to the second. 


Best regards


Solution

Carlos Lessa wrote:

cpinho wrote:

Vani Mankad wrote:

Restore the first API response in separate variable and then pass the input to 2nd API.

Another thing to observe, the data type of the input value - Do convert ID to Input value data type

Hi Vani


Thanks. I am passing the response to a local variable list.

Now, I have trying to iterate the list with for each, but I am getting lost.Can you assist?


Hi if I'm not wrong and you are saving the response from the first api to a local list, your second api is being executed with the default values from your local variable, what I mean is that the 2 API will be executed before the end of the first, will just wait if you use direct the response as input parameter to the second. 


Best regards



yes this can be the case. really appreciate way of thinking. :)

Abdul quadir Saifee wrote:

Carlos Lessa wrote:

cpinho wrote:

Vani Mankad wrote:

Restore the first API response in separate variable and then pass the input to 2nd API.

Another thing to observe, the data type of the input value - Do convert ID to Input value data type

Hi Vani


Thanks. I am passing the response to a local variable list.

Now, I have trying to iterate the list with for each, but I am getting lost.Can you assist?


Hi if I'm not wrong and you are saving the response from the first api to a local list, your second api is being executed with the default values from your local variable, what I mean is that the 2 API will be executed before the end of the first, will just wait if you use direct the response as input parameter to the second. 


Best regards



yes this can be the case. really appreciate way of thinking. :)

Try to use direct without assign to a local variable and let us know if start to work


Hi guys


Thank you very much for your support. I was able to solve my problem in two different ways. One very slow, another, still slow but not that much.


Any idea on how to improve it? [Devices] is a local var where values from previous API call are stored.