Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamically calling several back-end endpoints from within Azure APIM policy

I'm calling a back-end API from Azure API Management (APIM) and I need to provide the JSON schema for my custom connector in Logic Apps/Flow.

Depending on the content of the response I'm getting, I need to perform additional calls in order to provide an enumeration/drop down.

Consider a response from the back-end API, like this:

{
  "member1": {
    "prop": "content"
  },
  "member2": {
    "prop": "content",
    "datasource": "http://someurl.com/api/member2/content"
  },
  "member3": {
    "prop": "content"
  },
  "member4": {
    "prop": "content"
    "datasource": "http://someurl.com/api/memberfour/content"
  }
}

I need to perform additional calls to the URLs in the "datasource" members in order to provide additional data, but these are obviously dynamic, depending on the call I'm performing. I'm a bit stuck since I can't seem to perform a send-request policy for a dynamic number of calls and URLs. How would I best approach this?

like image 708
zurebe-pieter Avatar asked Nov 08 '22 15:11

zurebe-pieter


1 Answers

If I understand the scenario correctly, I don't think you want to use APIM to make the calls to the datasource URLs because then you wouldn't be able to get those results back to logic apps. I think what you are looking for is the x-ms-dynamic-values which is documented here

You can use this extension to describe both the primary operation which will provide your content and some secondary operations that will return the lists used to fill the drop downs for the Logic Apps UI. You will probably need to create additional APIM operations to surface those lists.

like image 152
Darrel Miller Avatar answered Nov 15 '22 08:11

Darrel Miller