Enrich data inside a function with a second api call

Hi guys

I try to use the how to guide inside the learning ressources to enrich my data with additional api queries.

Like in the use case, i have one api call to fetch all endpoints and then i would like to run a second api call to fetch details about every endpoint. but i dont unterstand, how i can pass the needed information from the first api to the second query

In my case, i have to run the second query (blue) for all endpointObj.id from the from the first query (red). The second query needs the id as a param.
Bildschirm­foto 2022-12-12 um 10.56.32

I tried something like this:
https://server/api/{{function_endpoint_details.getEndpointDetails(endpointObject.endpointObj.id)}}

When i run only the first api, the output looks like this one:
Bildschirm­foto 2022-12-12 um 10.59.06

From the code shared above, I see only one API/query get_ise_endpoint_filtered. From the response of this action you create a new array of objects that presents the data in the form that you want. (Please correct me i’ve missed something).

Now there is another action that expects to get the id and then fetch more info, right?

From the URL you’ve shared it looks like you are calling the function and passing some param, but you are not using that param in the function body to get the actual data of the id being passed.

1 Like

I have two queries:

First: “get_ise_endpoint_filtered”
Here I get all endpoints and those unique id.

Second: “get_ise_endpoint_filtered”
Here i have to pass the id from the first query inside the url for this second query. I try it with the url i shared above:
“https://server/api/{{function_endpoint_details.getEndpointDetails(endpointObject.endpointObj.id)}”

My try was to adapt the how-to guide from appsmith with the user enrichment example i linked above. but i dont understand how the second query will look like and get called for every id from the first query.

Hi! Could you invite support@appsmith.com as Developer to your workspace and share the link of your app with us so we can debug it?

1 Like

Sure, but actualy my deployment is on a self-hosted system with no access from outside. I try to make it accessable from outside or move it to a cloud based instance. I will let you know, when it was ready for testing.

Thank you for your assistance pranav!

What was the solution to this? What does the second API call look like and how can you send data from the first to the second within a JS Object?

Unfortunatly I had to debug my upgrade problem to 1.9.x first until i can make any further tries with the enrichment.

so it status quo at the moment