我正在尝试使用 Yammer API 在 Yammer 上创建帖子, 我有以下代码:
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/TR/html5/">
<head>
<meta charset="utf-8" />
<title>YammerNotification - Version 1</title>
<script src="https://assets.yammer.com/platform/yam.js"></script>
<script>
yam.config({ appId: "APP-ID" });
</script>
</head>
<body>
<button onclick='post()'>Post on Yammer!</button>
<script>
function post() {
yam.getLoginStatus(function (response) {
if (response.authResponse) {
yam.request(
{
url: "https://www.yammer.com/api/v1/messages.json"
, method: "POST"
, data: { "body": "This Post was Made Using the Yammer API. Welcome to the Yammer API World." }
, success: function (msg) { alert("{Post was Successful!}: " + msg); }
, error: function (msg) { alert("Post was Unsuccessful..." + msg); }
}
)
} else {
yam.login(function (response) {
if (!response.authResponse) {
yam.request(
{
url: "https://www.yammer.com/api/v1/messages.json"
, method: "POST"
, data: { "body": "This Post was Made Using the Yammer API. Welcome to the Yammer API World." }
, success: function (msg) { alert("{Post was Successful!}: " + msg); }
, error: function (msg) { alert("Post was Unsuccessful..." + msg); }
}
);
}
});
}
});
}
</script>
</body>
</html>
不过我的 APP ID 是什么?我如何告诉它我想将帖子发布到哪个组?
非常感谢任何建议
亚默
最佳答案
...what would my APP ID be?
您需要按照此处记录的方式注册应用程序 - https://developer.yammer.com/introduction/#gs-registerapp你的APP ID就是客户端ID的值
And how do I tell it what group I want to put a post to?
在 json 数据输入中指定 groupID:
data: {
"body": "This Post was Made Using the Yammer API. Welcome to the Yammer API World."
,"group_id" : groupID
}
在此处查看完整的示例代码 - http://blogs.technet.com/b/israelo/archive/2014/10/21/yammer-js-sdk-for-dummies.aspx
关于Yammer API - 在 Yammer 上创建帖子,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26277837/