【发布时间】:2015-07-07 03:41:26
【问题描述】:
我尝试在 yammer 的特定组中发布以下代码。
function post() {
yam.getLoginStatus(
function(response) {
if (response.authResponse) {
console.log("logged in");
console.dir(response); //print user information to the console
yam.platform.request({
url: "https://www.yammer.com/api/v1/messages.json"
, method: "POST"
, data: { "body" : "Welcome to the Yammer API World.", "group_id":"xxxxxxx"}
, CORS: true
, dataType: "json"
, headers: { "Accept": "application/json; odata=verbose" }
, xhrFields: { withCredentials: true }
, success: function (msg) { alert("Post was Successful!: " + msg); }
, error: function (msg) { alert("Post was Unsuccessful..." + msg); }
});
}
else {
yam.platform.login(function (response) {
if (response.authResponse) {
console.dir(response);
yam.platform.request({
url: "https://www.yammer.com/api/v1/messages.json"
, method: "POST"
, data: { "body" : "Welcome to the Yammer API World.", "group_id":"xxxxxxx"}
, CORS: true
, dataType: "json"
, headers: { "Accept": "application/json; odata=verbose" }
, xhrFields: { withCredentials: true }
, success: function (msg) { alert("Post was Successful!: " + msg); }
, error: function (msg) { alert("Post was Unsuccessful..." + msg); }
});
}
});
}
});
}
在 HTML 文件中我添加了这段代码
<script type="text/javascript" data-app-id="xxxxxxxxxxxxxxxx" src="https://c64.assets-yammer.com/assets/platform_js_sdk.js"></script>
上面的代码抛出错误为
我有什么遗漏的吗?
【问题讨论】:
标签: javascript rest sharepoint-2013 yammer