How to Create Item using Send An HTTP Request to SharePoint

Though there is an option to create an item using the existing flow action, there are times that you need to create an item dynamically. Hence, this topic will tell you the best way to create an item using the ‘Send an HTTP Request to SharePoint’ action. In this example, we will be creating an item in a custom list.

To start, add the ‘Send an HTTP Request to SharePoint’ action in your flow.

Search for Send an HTTP Request to SharePoint action
Send an HTTP Request to SharePoint action

Only three inputs are required in the action – Site Address, Method, and Uri. However, since we are creating an item, you will also need to provide the Headers and Body. Check below the simple descriptions and sample inputs for each field.


Site Address

In the Site Address field, write the site address of the list where you want to create the item.
Ex: https://mysite.sharepoint.com/sites/SampleSite 

Send an HTTP Request to SharePoint set Site Address

Method

Because we want to create an item, we will be using POST method. POST request is a request method used to create / update data. It provides secure server communication.

Send an HTTP Request to SharePoint set Method

Uri

Uri represents Uniform Resource Identifier. Here, we will provide the rest endpoint that we will be using to create an item. The Uri that we will be using is /_api/web/lists/GetByTitle(‘<List Display Name>’)/Items
Ex: /_api/web/lists/getbytitle(‘Test’)/Items

Send an HTTP Request to SharePoint set Uri

Headers

The Headers field is not required. However, it is very convenient when accessing and reading the response data. To create an item, we only need one header key – Content-Type.

Key: Content-Type
Value: application/json;odata=verbose

Send an HTTP Request to SharePoint set Headers

Body

In the Body of the request, we will be using a JSON.

How to build the JSON?

  • Provide the internal name of the metadata and its value.
  • Provide the metadata type of the item.

Refer to the example below:

{
   "__metadata": {
               "type": "SP.Data.TestListItem"
    },
    "Title": "<title value here>",
    "Description": "<description value here>"
}

For the metadata type value, take note that the value should be SP.Data.<list internal name>ListItem. In this syntax you should take note that you need the list internal name concatenated with ListItem. For example, I have a custom list which has the internal name Test, so the metadata type value should be SP.Data.TestListItem.

Send an HTTP Request to SharePoint set Body

Now you are all set. For questions and clarifications, please write it as a comment below. Have a nice day! 

Accounting.js Automation Collaboration Competitors Connect Content Type Design Expand Flows Hillbilly Tabs Issues Javascript Limitation Limitations Microsoft Teams ModernScriptEditor NodeJs Node Versioning Numeral.js O365 Office 365 OneDrive Out Of The Box PnP Power Automate PowerShell Pwermissions Rest Endpoint ScriptEditor Send an HTTP Request to SharePoint SharePoint SharePoint Architecture SharePoint Designs SharePoint Modern SharePoint Online SharePoint Tabs ShellScript SPFX SPO Sync Teams Transform JS TypeScript Versioning Workflows

3 thoughts on “How to Create Item using Send An HTTP Request to SharePoint”

Leave a Comment

Your email address will not be published. Required fields are marked *