Problems with yammer js sdk
We are facing the following error while accessing the Yammer API.
JQMIGRATE: jQuery.parseJSON requires valid JSON string platfor ..._ sdk.js (line 31) Cross-origin request blocked: Same origin policy disallows reading remote resource at https://www.yammer.com/api/v1/suggestions .json . This can be fixed by moving the resource to the same domain or by enabling CORS.
Ref: Yammer JS SDK - CORS Issues It says the issue has been resolved. But we still face this issue. Please confirm if the issue is resolved.
Regards, Parameswaran.
source to share
When using the Yammer SDK Yammer, you will need to link to api.yammer.com instead of www.yammer.com/api/v1.
Or better yet, if you want to clean up the url, you can omit the protocol, domain and additional functionality (/ api / v1) and include the REST resource (suggestions in your case) and output format (json). See example below:
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")
}
}
);
source to share