Calling REST API with Microsoft FlowOn 3 minutes
Can I access any REST API endpoint from Microsoft Flow? Yes, you can, and it is surprisingly easy if you know how. I will walk you through accessing SharePoint and custom REST APIs in this post.
We will start by adding The
Send HTTP Request to SharePoint action to the flow. If you are calling any other REST API, use the
HTTP action instead.
The notable thing about this SharePoint REST API call is that, I am using
Accept: application/json;odata=nometadata as the requesrt header. If you are new to this, read this blog post here. This will ensure you get a JSON payload with little metadata returned from SharePoint, reducing the size significantly.
If you are sending to a custom API,
The response from the request will be JSON from the SharePoint call, annd hopefully from your custom API as well. You can access the data from the response by querying the body of the action. You can access the JSON content using the expression
We can then access any property from the parsed JSON body content using the square bracket property access notation;
In our example, we can access the
value property of the SharePoint returned JSON by using the expression
Alternatively, we can utilize the dynamic content panel. For the dynamic content dialog to be aware of the parameters, we would need to tell it. We can do that by adding the
Parse JSON action after the HTTP call.
For the schema, we can click on
Use sample payload to generate schema link to help us generate the schema.
value property is an array, we will use the
Apply to each control to loop the items.
From the image above, we are able to access the
value property and also the properties of individual item in the
value array object like