【问题标题】:yammer js sdk issuesyammer js sdk 问题
【发布时间】:2014-08-28 06:23:53
【问题描述】:
【问题讨论】:
标签:
javascript
sdk
yammer
【解决方案1】:
使用 Yammer JS SDK 时,您需要引用 api.yammer.com 而不是 www.yammer.com/api/v1。
或者更好的是,如果您想清理 url,您可以省略协议、域和附加内容 (/api/v1),并包含 REST 资源(在您的情况下为建议)和输出格式 (json)。请参见下面的示例:
yam.getLoginStatus(
function(response) {
if (response.authResponse) {
console.log("logged in");
yam.platform.request({
url: "suggestions.json", //this is one of many REST endpoints that are available
method: "GET",
data: { //use the data object literal to specify parameters, as documented in the REST API section of this developer site
"letter": "a",
"page": "2",
},
success: function (user) { //print message response information to the console
alert("The request was successful.");
console.dir(user);
},
error: function (user) {
alert("There was an error with the request.");
}
});
}
else {
alert("not logged in")
}
}
);