Find your content:

Search form

You are here

Why would this Chatter REST Api Http POST return a 500 Server Error?


I'm using C#.Net to (upload) POST a new User Photo to Salesforce.

Using Fiddler I'm able to monitor the HTTP activity to and from my computer.

Here's the raw data I'm sending in the POST (with parts in brackets excluded):

POST[my User Id]/photo HTTP/1.1
Authorization: OAuth [my Salesforce Session Id]
Content-Type: multipart/form-data; boundary=8cfa2a52b1be413
Content-Length: 15054
Expect: 100-continue

Content-Disposition: form-data; name="xml"
Content-Type: application/xml; charset=UTF-8
Content-Transfer-Encoding: 8bit

Content-Disposition: form-data; name="fileUpload"
Content-Type: application/octet-stream; charset=ISO-8859-1
Content-Transfer-Encoding: binary

[binary data for a jpg file]

However, I'm receiving this error back from Salesforce:

HTTP/1.1 500 Server Error
Date: Fri, 07 Dec 2012 21:17:58 GMT
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked

[{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 160445444-13550 (94877017)","errorCode":"UNKNOWN_EXCEPTION"}]

Does anyone know what would cause this?

Attribution to: Matt K

Possible Suggestion/Solution #1

Thoughts: Looking at the documentation you appear to be doing the correct thing here, and as per below this is an unexpected exception from the platform. So other than following the support route (which would not harm), we are on our own. So its time to experiment, apologies if you have tried some of these, but maybe some will spark another avenue...

  • Have you tried it with the /user/me/photo?
  • Have you tried it with a different image format?
  • Have you confirmed the content of the tag is valid?
  • What happens if you don't send the image data? Does it give another error that is meaningful? Perhaps relates to some other issue the unhandled one is masking?
  • Does it work if you do it via the UI?
  • Can you find another app that does this and use Fiddler to review its HTTP messages?
  • Have you tried it in a Developer Org as apposed to your Sandbox?

Salesforce Internal Error Codes: What your receiving is an unhandled / unexpected exception from Salesforce. Only Salesforce support can decode internally the error message behind it and hopefully give you a clue as to what might be going wrong to cause this. As its unhandled / unexpected its likely you've found a bug of some kind. However its also likely the correct passing of information can be found once more is known, as I suspect this a issue in the API's internal validation code. As the message says I would contact Salesforce support and provide them with the codes.

Please include this ErrorId if you contact support: 160445444-13550 (94877017)

Attribution to: Andrew Fawcett
This content is remixed from stackoverflow or stackexchange. Please visit

My Block Status

My Block Content