Wednesday, September 26, 2018

LogicApp–HttpRequest trigger: retrieving query parameters

With a Http request based trigger, how do you retrieve the query parameter values (eg: &queryParamName=hello%20world)? I did not find an answer easily on the internet, so here it is:

@triggerOutputs()['queries']['queryParamName']

image

The above example, will retrieve the query param value for a query param named “queryParamName” and return it as a response.

Another way to achieve the same thing, but in a simpler manner is to use the RelativePath:

image

When you add the relative path, you will have to get the updated HTTP Get URL (that gets generated for you) and in the URL you will find

invoke/queryParamName/{queryParamNameVar}

To call the logic-app, all you have to do is replace the bolded section with a value (invoke/queryParamName/hello%20world/.

I prefer using the relative-path method, because you will find that the logicApp designer will make the variable (in this case queryParamName), easily available to other actions, which is not just nicer, but also protects you from typos.

1 comment:

Raj Rao said...

For more info: https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-http-endpoint#accept-parameters-through-your-http-endpoint-url