我可以将消息发布到yammer,但消息会发布到默认网络,我需要在不同的网络中发布。
这是我目前的测试代码:
<html>
<head>
<title>A Yammer App</title>
<script src="https://assets.yammer.com/platform/yam.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
yam.config({appId: "######"});
</script>
</head>
<body>
<button onclick='post()'>Yammer Update!</button>
<script>
function post() {
yam.getLoginStatus( function(response) {
if (response.authResponse) {
postdata();
} else {
yam.login( postdata);
}
});
}
function postdata()
{
yam.request(
{ url: "https://www.yammer.com/api/v1/messages.json"
, method: "POST"
, data: { "body" : "Message Throug app","group_id":"3156478"}
, success: function (msg) { alert("Post was Successful!: " + msg); }
, error: function (msg) { alert("Post was Unsuccessful..." + msg); }
}
);
}
</script>
</body>
</html>
答案 0 :(得分:0)
在发送之前在yam.request中添加以下功能。
beforeSend: function (req) {
//send the access_token in the HTTP header
req.headers.Authorization = "Bearer ####@#@#@SSA";
}
承载者将是您要定位的网络的自动化令牌。