According to Yammer documentation https://developer.yammer.com/restapi/#rest-messages
You are supposed to pass parameters to the request, not a plain string in your post. (Otherwise, how do you expect Yammer to know what is the body, what are the topics, the attachements ...)
Typically, this is done using a UrlEncodedFormEntity
with a list of NameValuePair
.
Your entity should look like this :
List<NameValuePair> values = new ArrayList<NameValuePair>();
values.add(new BasicNameValuePair("body", "hi this is deloitte game.");
HttpEntity postEntity = new UrlEncodedFormEntity(values);
post.setEntity(postEntity);
It is possible that the service is actually expecting a JSON input, in which case it is even simple.
edit
If it is in json, i could look like :
JSONObject jsonObject = new JSONObject();
jsonObject.put("body", "hi this is a body");
post.setEntity(new StringEntity(jsonObject.toString()));