Creating POST method in Power Automate

POST is a request method supported by HTTP. The POST request method requests that a web server accepts the data enclosed in the body of the request message, most likely for storing it. POST method is used to send data to a server for the creation or to update the resource.

We will create a POST method in power automate that accepts the JSON object, inserts a new JSON object into the SharePoint list, and returns the ID of the inserted item.

The body should be our JSON object. We are using the following JSON object body:

{
"product": "Testing",
"price": 444,
"category": "Electronics"
}

Once the API call for the POST method is successful it will return the status code 200 OK.

  • Before starting, we need to create a list on the SharePoint site.
    For a detailed explanation on SharePoint site list creation g
    o to Actions Chapter.
  • Create a list name Product List in your SharePoint site. We have few items already created in our SharePoint list.
    before-post-power-automate
  • Go to Microsoft Power Automate. Sign in to your account.
    power-automate-home-page3
  • Click on Create and then click on Instant cloud flow.
    create-instant-flow
  • Name the Flow and click on Skip.
    name-instant-cloud-flow-api-power-automate
  • Select When an HTTP request is received from Triggers.
    http2-api-power-automate
  • Select the method as POST. To generate schema click on Use sample payload to generate schema. We are generating schema so that we can access the properties of the JSON object.
    schema-post-power-automate
  • Enter JSON object and click on Done.
    json-post-power-automate
  • Now, we have our schema generated through our JSON object. Click on the New step.
    generated-schema-post-power-automate
  • Select Create item (SharePoint) from Actions.
    create-item-post-power-automate
  • Enter the SharePoint site address and our Product List name. Add Title as product, Category as category, and Price as price from dynamic contents. Click on the New step.
    create2-item-details-post-power-automate
  • Select Response (Request) from actions.
    response2-get-power-automate
  • Status code is automatically generated with the value of 200. Click on add dynamic content.
    add2-dynamic-content-get-power-automate
  • Select ID from dynamic contents.
    id-post-power-automate
  • Click on Save.
    response-post-power-automate
  • After clicking on Save, an HTTP URL will be generated. Go back to the HTTP trigger. Copy the HTTP POST URL.
    generated-url-post-power-automate
  • Go to the Postman site and Sign in to your account.
    postman-official-page
  • Add the URL for the POST method.
    add-url-post-power-automate
  • After adding the URL click on Body.
    click-body-post-power-automate
  • In the Body section, select raw and JSON.
    click-raw-post-power-automate
  • Add the JSON object to the body and click on Send.
    response2-before-output-power-automate
  • Here, a new ID is generated for our object. We get status code 200 OK after the successful completion of our API call.
    id-output-post-power-automate
  • Here, we have number 6 as ID generated in our SharePoint list.
    output2-post-power-automate
About Author :

I am Sharvari Raut, having sound knowledge and experience in technical writing. Currently, pursuing my B.Tech in Computer Science and Engineering.

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions