How to get SharePoint list items using Rest API in Microsoft Power Automate

This Microsoft flow or Power automate tutorial, we will discuss how to get SharePoint list items using Rest API in Microsoft Power Automate.

get SharePoint list items using Rest API in Microsoft Power Automate

In this example, I have created a SharePoint list as “City” where I have added an item in the Title column. Now, we see how to get all list items through REST API in Microsoft Power Automate (Flow).

microsoft flow get sharepoint list item rest api

In SharePoint Online custom list, when an item is created, a mail needs to be sent using the Title column in the mail. This needs to be achieved through Microsoft Power Automate (Flow).

Let’s move to Microsoft Power Automate (Flow).

Click this URL to go to Microsoft Power Automate (Flow). The following screen appears. In the Microsoft flow home page, from the left navigation, select Templates. From the main window, now, select the “Send an email when a new item is created in SharePoint” template.

microsoft flow http request sharepoint rest api

After selecting the template, the following screen appears. Click the “Continue” button.

microsoft flow sharepoint rest api 1

On the next screen, add a new action by clicking the + sign and expand.

microsoft flow call sharepoint rest api

In the Microsoft Flow first block, the following section appears. Add the SharePoint site address of your relative SharePoint site collection URL and select the List name in which you implemented the operation.

get list items microsoft flow

In the second block, the following section appears In this section, declare the variable name and set the created itemId.

get list items using microsoft flow

The third block asks us to add the ‘Send an HTTP request to SharePoint’ action to execute REST API on current created ItemId.

microsoft flow get list items filter query

Lots of people are confused about how to parse the JSON Schema data. Let us see the steps on how to get the Parse JSON Schema data.

Open the site in a browser and press F12 to open the browser console prompt. Add the following JavaScript code. This code will add a jQuery CDN in the head section of your page which will help us to call the REST API.

var element = document.createElement("script");  
element.type = "text/javascript";  
element.src  = "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js";  
document.head.append(element);  
microsoft flow get sharepoint list items

Call the REST API and in debugger mode, assign JSON.stringify(data) to the variable. Don’t stop debugger before assigning the JSON data to declare variable (jsonvar). Copy the variable value.

$.ajax({    
url: "https://pointerone.sharepoint.com/sites/SPFXDemo/_api/web/lists/GetByTitle('City')/items(1)",    
method: 'GET',    
headers: {    
"Accept": "application/json; odata=verbose",    
"content-type": "application/json; odata=verbose",
}, success: function (data){   
debugger;  
}});  
get SharePoint list items using Rest API in Microsoft Power Automate

In the fourth block, we need to add the ‘Parse JSON’ action to execute the REST body Schema.

get list items microsoft power automate

Click the above screen pop up. Use sample payload to generate schema link. Then, the following screen pops up. Here, paste the JSON.stringify(data) in the below block. Click the “Done” button.

get list items using microsoft power automate

In the last section, we add the ‘send mail’ action. Here, let us set the To, Subject, and Body fields and save the flow.

microsoft power automate get list items filter query

Add an item in the City SharePoint List.

get list items using power automate rest api

See the Microsoft Power Automate (Flow) status.

get list items power automate using rest api

In Outlook mail, the screen appears with the currently added city name like below:

microsoft power automate get sharepoint list item rest api

Note
Limits and configuration in Microsoft Power Automate (Flow) post

You may like Microsoft Flow or Power Automate tutorials:

This tutorial, we learned how to get SharePoint list items using Rest API in Microsoft Power Automate.

Donwload Hub site pdf

Download SharePoint Online Tutorial PDF FREE!

Get update on Webinars, video tutorials, training courses etc.

>