Home > Blockchain >  Azure Functions Orchestration using Logic App
Azure Functions Orchestration using Logic App

Time:09-21

I have multiple Azure Functions which carry out small tasks. I would like to orchestrate those tasks together using Logic Apps, as you can see here: Logic App Flow

I am taking the output of Function 1 and inputting parts of it into Function 2. As I was creating the logic app, I realized I have to parse the response of Function 1 as JSON in order to access the specific parameters I need. Parse JSON requires me to provide an example schema however, I need to be able to parse the response as JSON without this manual step.

One solution I thought would work was to register Function 1 with APIM and provide a response schema. This doesn't seem to be any different to calling the Function directly.

Does anyone have any suggestions for how to get the response of a Function as a JSON/XML?

CodePudding user response:

You can run Javascript snippets and dynamic parse the response from Function 1 without providing a sample.

e.g.

var data = Object.keys(workflowContext.trigger.outputs.body.Body);

var key = data.filter(s => s.includes('Property')).toString(); // to get element - Property - dynamic content

return workflowContext.trigger.outputs.body.Body[key];

https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-add-run-inline-code?tabs=consumption

  • Related