cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate II
Advocate II

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
Highlighted
Super User II
Super User II

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']}"
        }
Highlighted
Community Support
Community Support

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Users online (5,669)