7

I am trying to merge an item into an existing list in SharePoint Online, but receive the following error:

"The type SP.ListItemEntityCollection does not support HTTP PATCH method."

My configuration is as stated in Microsoft documentation. https://msdn.microsoft.com/en-us/library/office/jj164022.aspx

Is there a problem with the permissions for this type of item in the list? How can I modify that? I have seen no references to different types, or resolving this issue.

Blake Lassiter
  • 383
  • 2
  • 4
  • 18

2 Answers2

9

This error usually occurs when invalid resource endpoint is specified.

Endpoint to create SP.ListItem resource

Url : /_api/web/lists/getbytitle(<listTitle>)/items
Method: POST
Data: <item payload>

Make sure endpoint for SP.ListItemEntityCollection resource is specified for that operation.

Endpoint to update SP.ListItem resource

Url : /_api/web/lists/getbytitle(<listTitle>)/items(<itemid>)
Method: POST
Headers:
    "X-HTTP-Method": "MERGE",
    "If-Match": "*"
Data: <item payload>

Make sure SP.ListItem resource url is specified for that operation. For example, the following url /_api/web/lists/getbytitle(<listTitle>)/items?$filter=Id eq 1 is invalid in that case and the specified error will occur while updating list item.

Vadim Gremyachev
  • 57,952
  • 20
  • 129
  • 193
1

The same error "The type SP.ListItemEntityCollection does not support HTTP PATCH method." is shown when its intended to create an item but the headers to update an item is used.

For example, updating an item uses this header ->

"Accept": "application/json;odata=verbose",
"X-RequestDigest": *__REQUESTDIGEST*,
"X-HTTP-Method": "MERGE",
"If-Match": "*"

And creating an item uses this header ->

"Accept": "application/json;odata=verbose",
"X-RequestDigest": *__REQUESTDIGEST*

In my case - I reused the code to update an item to create an item and got the same error message. Rookie mistake, but a mistake nonetheless.

snugam
  • 11
  • 2