+ Start a Discussion

Upload User Picture Profile photo with Rest CHATTER API

Hi everybody

I got a problem, trying to upload a picture profile photo, So I've been trying to do this in may ways, apperently you cannot do this with a simple query, you have to do this by the Chatter REST API, So here I got my problem, I'm trying to upload this by two ways.

- One, with javascript, calling background the Chatter REST API

- two, with the "ConnectApi" APi, it should work, but there is no way. I got this problem.


Error: TestController Compile Error: Dependent class is invalid and needs recompilation: ConnectApi.feeditempage: line 8, column 25: Dependent class is invalid and needs recompilation: ConnectApi.feeditem: line 6, column 20: Dependent class is invalid and needs recompilation: ConnectApi.actor: line 38, column 15: Dependent class is invalid and needs recompilation: ConnectApi.unauthenticateduser: line 2, column 50: Invalid class: actor at line 3 column 9


Can someone help me how to solve this ? Or maybe tell me how to do this task without using chatter rest API



Hi Mixel007,


What is the error you are getting with the Chatter REST API? You have to make a multipart HTTP request in order to upload a new photo. Our documentation around making multipart requests has been updated, hopefully it helps: http://www.salesforce.com/us/developer/docs/chatterapi/Content/intro_input.htm


As for the ConnectApi namespace, this is part of the new "Connect in Apex" feature which was in pilot only, and as of Spring 13 is available in only dev orgs. If you are using a dev org then once you get onto Spring 13 you should be able to make this call. However, you cannot yet package code using Connect in Apex to distribute to other orgs.