function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jamie ThompsonJamie Thompson 

How can I use Chatter API to update profile with PATCH method?

Hello - I'm using the Chatter API for iOS and Android. I was wondering if anyone has any code samples of using the PATCH method for updating profile parameters - where the values are in the json/xml?  I can't seem to find any samples. 

 
jody_blyjody_bly
Does this help? 
https://www.salesforce.com/us/developer/docs/chatterapi/Content/quickreference_update_user_profile.htm
Jamie ThompsonJamie Thompson
Thanks Jody - do you have any code samples for the PATCH method for nickname, name, avatar?  I'm guessing this would be communityNickname, displayName and photo?

There's a lot of properties there and not much in the way of code samples for them. :( 
jody_blyjody_bly
Hi Jamie -- the only property you can PATCH with that resource is aboutMe. You can use other Chatter REST API resources to update the user photo (or a group photo) and change email notification settings. To update your name, you need to use the regular REST API:

https://www.salesforce.com/us/developer/docs/api_rest/Content/dome_update_fields.htm
Jamie ThompsonJamie Thompson
Thanks Jody,

I have tried to updated Account fields successful. But I actually want to update User fields (Name, Nickname...). That was not working for User. I am not sure that I was giving correct uri. Here is the uri. Can you correct me?

https://cs21.salesforce.com/services/data/v20.0/sobjects/User/005q0000001F7pGAAS?_HttpMethod=PATCH
jody_blyjody_bly
Make sure you're using the correct field name and that the field has the Update property. 
www.salesforce.com/us/developer/docs/object_reference/Content/sforce_api_objects_user.htm

For example, the User object's FirstName field can be updated. Passing this JSON request body updates the field:

/services/data/v34.0/sobjects/User/005D0000001UEiD
{ "FirstName" : "Natalie" }
Jamie ThompsonJamie Thompson
Thanks Jody. It's working.
Anthony HernandezAnthony Hernandez
Hi Jamie, do you have a working iOS code sample? I've been strugling with this for a while. I can query information very easily, but have stumbled on updating the objects.