REST API to create and update SharePoint list items from Power Automate

5 min read

If you want to make any changes in SharePoint from Power Automate the Rest API is one of the best options to use. SharePoint has its own Rest APIs that can be used to create site/items/files/folders, or update site/items/files/folders or to make any changes in site or any update within SharePoint for which a Rest endpoint is available. So, you will use “Send HTTP Request to SharePoint” action to send Rest API calls to perform any operation in SharePoint.

So first we will go through some basic operations as follows:

  1. Create List Item
  2. Update List Item

Create List Item

There is already a built-in action in Power Automate called “Create Item” to create new list item in SharePoint list, but creating new List Item using Rest API call from Power Automate gives you more control and flexibility for example if you want to update the hyperlink column to have name “Microsoft” with link www.microsoft.com, then you wont be able to do it using Create Item, you will need to use REST API. Create Item will update both the name and URL with the link you provided in hyperlink column.

So, add “Send HTTP Request to SharePoint” action to your flow and configure your action as below:

Let us understand the parameters of this action:

  1. Site Address: Provide the Site URL where your list resides.
  2. Method: POST (as we want to make changes in SharePoint)
  3. URI: _api/lists/getbytitle(‘Documents’)/items/ (here in place of documents, put your List Title)
  4. Headers:
    1. content-type: application/json;odata=nometadata
    2. accept: application/json;odata= nometadata
  5. Body:
    1. Here is the main part, the values you need to set for the columns to create the list will go here, so in my example, I am setting four column values: Title, Link, Notes and Decision
    2. Title: This is single line of text column so it will be simple text value
    3. Link: This is Hyperlink type of column, so you need to provide the value in following format:
"Link": {
            "Description": "<Title of the link>",

            "Url": "<actual link>"

}
  1. Notes: This is multi line text column so it will be simple text value
  2. Decision: This is choice column, so this will also be a simple text value from the choice options that you have configured for the column.
  3. The format of value will you provide here changes depending on type of the column like it will be different for lookup column, Taxonomy, date and so on.
  4. One more important point to note, that column names that you provide here will be internal name of columns. How do you find the internal name of the column, go to your List Settings, then click on the specific column, then look at the browser URL, take the name what appears after the Field=

E.g. http://test.sharepoint.com/sites/test/_layouts/15/FldEditEx.aspx?List=%7BA4E78CC7-F74F-4733-832A-099D945908A8%7D&Field=Link is my URL when I click on Link field in List Settings, here my internal field name is Link, which I will use in the body parameter.

Full Body Parameter value

{

            "Title": "value",

            "Link": {

            "Description": "Microsoft",

            "Url": "http://www.microsoft.com"

            },

            "Notes": "value",

            "Decision": "value"

}

Update List Item

There is already a built-in action in Power Automate called “Update Item” to update existing list item in SharePoint list, but updating List Item using Rest API call from Power Automate gives you more control and flexibility like, Update Item action requires you to update all the mandatory columns even though you don’t want to update those columns, and using REST API if you are required to update only those columns which you need to update.  So, add “Send HTTP Request to SharePoint” action to your flow and configure your action as below:

  1. Site Address: Provide the Site URL where your list resides.
  2. Method: POST (as we want to make changes in SharePoint)
  3. URI: _api/lists/getbytitle(‘Teams Requests’)/items(ItemID) (here in place of Teams Requests, put your List Title, and in place of ItemID, put ID of your item)
  4. Headers:
    1. content-type: application/json;odata=nometadata
    2. IF-MATCH: *
    3. X-HTTP-METHOD: MERGE
  5. Body:
    1. Here is the main part, the values you need to set for the columns to create the list will go here, so in my example, I am setting one column value: Status.
    2. Status: is a choice column in my list and I can simply provide a text value to update the choice column value.
    3. The format of value will you provide here changes depending on type of the column like it will be different for lookup column, Taxonomy, date and so on.
    4. Here again one more important point to note, that column names that you provide here will be internal name of columns. How do you find the internal name of the column, go to your List Settings, then click on the specific column, then look at the browser URL, take the name what appears after the Field=

E.g. http://test.sharepoint.com/sites/test/_layouts/15/FldEditEx.aspx?List=%7BA4E78CC7-F74F-4733-832A-099D945908A8%7D&Field=Status is my URL when I click on Link field in List Settings, here my internal field name is Status, which I will use in the body parameter.

Full Body Parameter value

{

            "Status":"Approved"

}

That’s it for now folks, thanks for reading the blog. There are many other REST API that I need to document, which I post on the blog in coming weeks.