我正在尝试使用REST API创建一个使用Yammer发布Poll的Java应用程序。
当我将poll
设置为message_type
和POST https://www.yammer.com/api/v1/messages
但返回状态400 Bad Request
时。
// 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);
如何使用REST API发布投票?
最好的祝福。
您询问了如何通过REST API发布投票,目前答案是它不受支持。我希望我有更好的答案,但Yammer开发者网站上没有记录这一点,并且您(以及您的用户)尝试对其进行逆向工程以包含在应用程序中存在风险。
如果您要对其进行反向工程,请使用当前代码捕获Fiddler跟踪,然后调整HTTP请求,直到它与Yammer站点匹配。
如果您想要支持API,那么您应该在Yammer UserVoice网站上发帖。如此多的请求以这样的线程结束,如果提高可见性会更好。