A tip: Updating Data in SharePoint 2010 using REST API
Posted
by Sahil Malik
on Win Smarts
See other posts from Win Smarts
or by Sahil Malik
Published on Wed, 12 Jan 2011 18:44:11 GMT
Indexed on
2011/01/12
23:56 UTC
Read the original article
Hit count: 225
SharePoint 2010
SharePoint 2010 Training: more information |
Here is a little tip that will save you hours of head scratching. See there are two ways to update data in SharePoint using REST based API. A PUT request is used to update an entire entity. If no values are specified for fields in the entity, the fields will be set to default values. A MERGE request is used to update only those field values that have changed. Any fields that are not specified by the operation will remain set to their current value. Now, sit back and think about it. You are going to update the entire entity! Hmm. Which means, you need to a) specify every column value, and b) ensure that the read only values match what was supplied to you. What a pain in the donkey! So 99/100 times, a PUT request will give you a HTTP 500 internal server error occurred, which is just so helpful.
© Win Smarts or respective owner