Using the HTTP action to make requests with Microsoft Flow
Using the HTTP card in Microsoft Flow and referencing the output parmeters in conditions
Last week I blogged about how you can use a simple custom API to send yourself weather updates periodically. Custom APIs are very useful when you want to reuse custom actions across many flows. If your scenario requires using the action just in one flow, writing a custom API for that one action could be a bit of an overkill. In this blog post, we are going to look at using the HTTP card and how to use it within a flow.
Again for this blog post – I am going to use the weather example, this time though from openweathermap.org to get the weather information for Seattle, US. Then I am going to check whether it is going to rain or not using the condition card, and send myself a push notification only if it’s going to rain.
Looking at the openweathermap APIs you can see that we need to make a GET request with the URI (as shown) to get the weather for Seattle, US.
The response body like this -
Specifically, we are interested in the property that's highlighted, if the value of the "main" property contains the word Rain, then we want the flow to send a Push notification, if not - do nothing.
To reference the property we will need to use the advanced mode on the condition card, and set it up as follows :
Learn more about flow expressions here : https://msdn.microsoft.com/library/azure/mt643789.aspx
This flow, will now send me a push notification whenever it detects rain. You can play around with how often you'd like to receive these notifications or setup various other conditions. The HTTP card is a very powerful tool to quickly get a custom action into Flow.
NOTE: We have a limitation today, where expressions can only be used in the advanced mode on the condition card. The HTTP + Swagger action can be used in scenarios where you want to use tokens from the response body, much similar to Custom APIs, which I will cover in a future post.