1

I'm trying to reply to a private conversation in Chatter via the REST API, by making a POST request to https://<<instance>>/services/data/v33.0/chatter/users/me/messages using jQuery's post() method.

Whatever I do I keep getting an HTTP 400 response with the error message:

"[{"errorCode":"MISSING_ARGUMENT","message":"Text parameter is missing or empty."}]"

The body I'm sending is valid, and I've tested it with workbench. The authorisation, content-type and accept headers have all been set to be the same as workbench too. Any idea of what this error is related to? I'm submitting the request like so, after setting the headers using $.ajax();:

$.post('https://c.na24.visual.force.com/services/data/v33.0/chatter/users/me/messages/',
  { 'body' : 'test from console', 'inReplyTo': '<<messageId>>'}, 
  function(data) { console.log(data); });
  • from what i remember about jquery it doesn't understand how send a json post, you need to use the actual serialized string as the payload param. – superfell Jun 15 '15 at 3:33
1

Turns out that even though the docs say the message text should be in the body parameter:

Image of the documentation showing the parameter is called 'body'

... and that body works as the parameter name in Workbench, renaming that parameter to text solves the problem!

 Object { body: "test - reply from the console.", inReplyTo: "<<message ID>>" } <- FAIL

 Object { text: "test - reply from the console.", inReplyTo: "<<message ID>>" } <- WIN
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.