Updating Multi User Field Values does not work with Rest API

%3CLINGO-SUB%20id%3D%22lingo-sub-115719%22%20slang%3D%22en-US%22%3EUpdating%20Multi%20User%20Field%20Values%20does%20not%20work%20with%20Rest%20API%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-115719%22%20slang%3D%22en-US%22%3E%3CP%3EDoes%20any%20one%20tried%20to%20update%20the%20Multi%20User%20field%20value%20using%20Rest%20API.%20I%20am%20not%20able%20to%20set%20the%20value%20and%20I%20always%20get%20the%20following%20error%20if%20I%20try%20to%20set%20multi%20user%20field%20value%3A%26nbsp%3B%3C%2FP%3E%3CP%3EMy%20request%20body%20is%20like%20this%3A%3C%2FP%3E%3CP%3E%7B%22articleDate%22%3A%222017-10-27T22%3A00%3A00.000Z%22%2C%22articleContactsId%22%3A%7B%22results%22%3A%5B31%5D%7D%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20also%20tried%20with%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3E%7B%22articleDate%22%3A%222017-10-27T22%3A00%3A00.000Z%22%2C%22%3C%2FSPAN%3E%3CSPAN%3EarticleContactsId%3C%2FSPAN%3E%3CSPAN%3E%22%3A%7B%22results%22%3A%5B%2231%22%5D%7D%7D%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EMy%20response%20is%3A%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EAn%20unexpected%20'StartObject'%20node%20was%20found%20for%20property%20named%20'articleContactsId'%20when%20reading%20from%20the%20JSON%20reader.%20A%20'PrimitiveValue'%20node%20was%20expected.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFor%20single%20user%20field%20user%2C%20I%20can%20set%20the%20user%20for%20updating%20item%20and%20I%20get%20204%20response.%20If%20anyone%20has%20correct%20example%20for%20multi%20user%2C%20please%20share.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-235716%22%20slang%3D%22en-US%22%3ERe%3A%20Updating%20Multi%20User%20Field%20Values%20does%20not%20work%20with%20Rest%20API%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-235716%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F85720%22%20target%3D%22_blank%22%3E%40Aruna%20Gottimukkala%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20assume%26nbsp%3Byou%20ended%20us%20resolving%20this%20as%20the%20post%20is%20a%20few%20months%20old%2C%20but%20replying%20in%20case%20someone%20else%20finds%20it%20(it%20came%20up%20on%20top%20of%20my%20search%20results%20%3A)%3C%2Fimg%3E%20)%3C%2FP%3E%3CP%3EI%20have%20just%20tried%20this%20and%20I%20can%20confirm%20that%20both%20options%20below%20(using%20strings%20or%20numbers)%20are%20working%20for%20me%2C%20for%20both%20single%20and%20multi%20value%20people%20fields.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20only%20moment%20I%20saw%20the%20error%20message%20below%20was%20when%20I%20only%20passed%20the%20array%20as%20the%20field%20value%2C%20not%20an%20object%20with%20the%20%22results%22%20property.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOn%20a%20side%20note%2C%26nbsp%3Bbe%20aware%20that%20user%20IDs%20are%20different%20between%20sites%2C%20so%20if%20you%20get%20the%20IDs%20from%20a%20site%20and%20try%20to%20add%20to%20a%20field%20on%20a%20different%20site%2C%20those%20IDs%20may%20not%20exist%20or%20it%20will%20result%20on%20the%20wrong%20people%20being%20added.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Contributor

Does any one tried to update the Multi User field value using Rest API. I am not able to set the value and I always get the following error if I try to set multi user field value: 

My request body is like this:

{"articleDate":"2017-10-27T22:00:00.000Z","articleContactsId":{"results":[31]}}

 

I also tried with 

{"articleDate":"2017-10-27T22:00:00.000Z","articleContactsId":{"results":["31"]}}

 

My response is: 

 

An unexpected 'StartObject' node was found for property named 'articleContactsId' when reading from the JSON reader. A 'PrimitiveValue' node was expected.

 

For single user field user, I can set the user for updating item and I get 204 response. If anyone has correct example for multi user, please share. 

 

1 Reply
Highlighted

Hi @Aruna Gottimukkala

 

I assume you ended us resolving this as the post is a few months old, but replying in case someone else finds it (it came up on top of my search results :) )

I have just tried this and I can confirm that both options below (using strings or numbers) are working for me, for both single and multi value people fields.

 

The only moment I saw the error message below was when I only passed the array as the field value, not an object with the "results" property.

 

On a side note, be aware that user IDs are different between sites, so if you get the IDs from a site and try to add to a field on a different site, those IDs may not exist or it will result on the wrong people being added.