我已经在我的项目中集成了yammer feed现在我需要计算在特定页面(URL)上发表的评论。
yam.connect.embedFeed({
container: '#yammer-feed'
,network: ''
,feedType: 'open-graph'
,feedId: ''
,config: {
use_sso: false
, header: true
, footer: true
, showOpenGraphPreview: false
, defaultToCanonical: false
, hideNetworkName: false,
hideAttachmentContainer: true
},
objectProperties:{
url: "*someurl*",
type: page
}
});
我需要知道如何获取上面objectProperties中提到的此特定URL的所有注释(消息)的计数。 是否有任何yammer API来计算,有人可以帮忙吗?
答案 0 :(得分:1)
有一个API调用来获取打开的图形对象的消息。我用它来获取所有消息,并通过它们枚举计数。您首先需要获取页面的Open Graph ID,然后将该ID传递给消息API。
//see if we have an OG object for the current page.
yam.platform.request(
{ url: "https://www.yammer.com/api/v1/open_graph_objects?url="+pageURL
, method: "GET"
, data: { "body": "This Post was Made Using the Yammer API. Welcome to the Yammer API World." }
, success: function (msg) {
//OG object exists.
ogID = msg.id;
}
, error: function (msg) {
//OG object doesn't exist, we need to creat it.
}
});
然后将Open Graph对象ID传递给消息API
//gets the comments count for the OpenGraph object
var commentCnt = 0;
yam.platform.request(
{ url: "https://www.yammer.com/api/v1/messages/open_graph_objects/"+ogID+".json"
, method: "GET"
, data: {"body": "This Post was Made Using the Yammer API. Welcome to the Yammer API World."}
, success: function (msg) {
if (msg) {
jQuery.each(msg.messages, function (index, element) {
commentCnt++;
});
}
//adds the count to the webpage.
jQuery("div#commentCnt").text(commentCnt);
}
, error: function (msg) {
//console.log("message lookup failed");
}
});
答案 1 :(得分:0)
这不是一个记录在案的API调用,但是我设法通过此请求获得了组更新计数: