Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Update List Item Using REST API: Error: InvalidClientQueryException

$
0
0

I have reviewed the assorted MS documentation on updating a list item value.  I am using an out of box LIST and I am using HTTPClient object to insert and (attempt to) update list items.  I successfully insert list items with REST URL like:

http://XXXXXX/_api/Web/Lists(guid'8913f9e0-6e51-40ef-813a-e6a261109cfa')/Items

and a JSON data load like:

{"__metadata":{"type":"SP.Data.NewListListItem"},"Title":"MYITEM1"}

I want update the item I just inserted and change the Title field.  The REST URL is like:

http://XXXXXX/_api/Web/Lists(guid'8913f9e0-6e51-40ef-813a-e6a261109cfa')/Items(24)

the JSON data load is like:

{"__metadata":{"type":"SP.Data.NewListListItem"},"Title":"666"}

The Headers (as reported by Fiddler) are:

Authorization                            NOT DISPLAYED IN THIS FORUM
Accept                          application/atom+xml
X-RequestDigest                          0x9C809D551C77096537550B3D9C6BAB6F3C4F6A9B0EA72DD4ABD69F2E0AAD1AC8A07DDAD8C74C4C9FB8442179F0D157C4C90796E2BE68337DD653
X-HTTP-Method                            Merge
If-Match                                 "1"
Content-Type : application/json; odata=verbose
Content-Length : 63

The HTTP Error is: Bad Request and the Sharepoint error is:

SPError Code: -1 Text: Microsoft.SharePoint.Client.InvalidClientQueryException 
Message: The parameter __metadata does not exist in method GetById.

Note That I AM supplying the X-HTTP-Method and IF-Match Etag Headers as required.

What am I missing here?

Thank You


HEY



Viewing all articles
Browse latest Browse all 7589

Trending Articles