I am trying to create a java app that posts Poll with Yammer using the REST API.
When I set poll
to message_type
and POST https://www.yammer.com/api/v1/messages
but status 400 Bad Request
is returned.
// Post
HttpPost httpPost = new HttpPost("https://www.yammer.com/api/v1/messages");
// Add header
httpPost.addHeader("Authorization", "Bearer " + accessAuthToken);
List<NameValuePair> nvps = new ArrayList<>();
nvps.add(new BasicNameValuePair("group_id", group));
nvps.add(new BasicNameValuePair("body", "message body 1"));
nvps.add(new BasicNameValuePair("message_type", "poll"));
// set entity
httpPost.setEntity(new UrlEncodedFormEntity(nvps, UTF8));
// execute
HttpResponse response = httpclient.execute(httpPost);
How can I post Poll using the REST API?
Best Regards.
You asked about how to post a poll via the REST API, and the answer at this time is that it's not supported. I wish I had a better answer, but this isn't documented on the Yammer Developer site and it's a risk for you (and your users) to attempt to reverse engineer it for inclusion in an app.
If you were to reverse engineer it, capture a Fiddler trace with your current code, and then tweak the HTTP request until it matches the Yammer site.
If you want an API supported then you should post on the Yammer UserVoice site. So many requests for things end in threads like this and it would be better if the visibility was raised.