cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
yapper
Level: Powered On

Send HTTP Request to Sharepoint: Quirks!

Starting this thread here to share some of the quirks I've come across with the "Send an HTTP Request to Sharepoint" Action. I'll add to it as more things pop up.

 

  1. Create Sharepoint List POST request:
    1. Headers:
      1. If you use...
        1. content-type: application/json;odata=verbose
      2. ...you must specify the __metadata object in the JSON body...
        1. {
              '__metadata': { 'type': 'SP.List' }, 
              'AllowContentTypes': true,
              'BaseTemplate': 100,
              'ContentTypesEnabled': true, 
              'Description': 'My first test list', 
              'Title': 'The coolest list ever'
          }
      3. If you use...(notice the colon and the double quotes)
        1. content-type: "application/json;odata=verbose"
      4. You must remove the __metadata object from the body!!
        1. {
              'AllowContentTypes': true,
              'BaseTemplate': 100,
              'ContentTypesEnabled': true, 
              'Description': 'My first test list', 
              'Title': 'The coolest list ever'
          }
        2. Otherwise the Flow will fail with the message: Status 400, Bad Request...
        3. {
            "message": "The property '__metadata' does not exist on type 'SP.List'. Make sure to only use property names that are defined by the type.\r\nclientRequestId: 4c16565b-cf95-42d9-9d9e-ddc2a5b01dec\r\nserviceRequestId: 2c680f9f-0032-0000-4762-24578c3e6a56",
            "status": 400,
            "source": "https://powerappers.sharepoint.com/_api/web/lists/",
            "errors": [
              "-1",
              "Microsoft.SharePoint.Client.InvalidClientQueryException"
            ]
          }

Hows that for quirky?

2 REPLIES 2
Gristy
Level 10

Re: Send HTTP Request to Sharepoint: Quirks!

I have a quirky one when trying to add to sharepoint navigation:

 

_api/Web/Navigation/GetNodeById(2031)/Children

 

It only works with the following which ends up meaning i need to go back in and delete junk out of the URL if you put the full url i.e. https:// flow does some funky stuff and trys to be too smart ! 😞

 

{
"__metadata": { type: "SP.NavigationNode" },
   'IsExternal': false,
      'Title': "@{triggerBody()?['Title']}",
        'Url': "//tenant.sharepoint.com/sites/Customers/Lists/Customers/DispForm.aspx?ID=@{triggerBody()?['ID']}"
        }
Community Support Team
Community Support Team

Re: Send HTTP Request to Sharepoint: Quirks!

 

Hi @yapper ,

 

Thank you for your sharing!

Please check this blog and get more details about SharePoint / Microsoft Flow – Maintain List details for no-code developers:

https://veenstra.me.uk/2018/08/28/sharepoint-microsoft-flow-maintain-list-details-for-no-code-develo...

 

The interaction between Headers and JSON Body is not specified by MS Flow. Send HTTP Request to SharePoint action only provides a configurable interface to help users edit the request. The specific configuration needs to be referenced in the SharePoint REST API.

https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/complete-basic-operations-using-sharepoin...

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (4,795)