Can I get Open Graph page with feed from the API

主宰稳场 提交于 2019-12-12 02:05:39

问题


What I am trying to do is programmatically create a yammer page based on other website URL (Open Graph Page) and feed information to that OG page. Which I have found out how to do. But now I want to retrieve the OG page feed programatically, is that possible? e.g.

GET https://api.yammer.com/api/v1/activity/OG_URL

which would return the OG Page with messages...


回答1:


I've also run into quite the same problem, related to fetching open graph objects created on an external Yammer network. To successfully perform the two calls as described by Raggi, use the specific token that is valid for the external network. You can get this token by performing this call (source) while logged in as a Verified Admin / using a token from a Verified Admin Yammer app: https://www.yammer.com/api/v1/oauth/tokens.json

From the list of tokens, select the token that matches the external network you use. When performing calls using this specific token (such as https://www.yammer.com/api/v1/messages.json or https://api.yammer.com/api/v1/open_graph_objects.json), they will be targeted at the external network rather than the default (internal) Yammer network.

I ran into this problem when I did the following: As a verified admin, I created a Yammer app on the external network. I used the token generated by the app (source) to create open graph objects on Yammer (wich also creates a post). When I tried to fetch data, such as number of likes, I kept getting 404. To me, it was as if the call tried to fetch data only from the default (internal) network, and was leaving out results from the external network.




回答2:


Ok, here's the solution that works for me.

First, get the OG page

yam.platform.request({
  url: "https://api.yammer.com/api/v1/open_graph_objects.json",
  method: "GET",
  data: {
    "url": "http://google.com/robots.txt" //Your OG URL
}, 
[...]

Then get the OG feed

yam.platform.request({ 
  url: "https://api.yammer.com/api/v1/messages/open_graph_objects/" + YOUR_OG_ID + ".json",
  method: "GET",
  data: {},
  [...]

Thanks to Guillaume Carlander for the tips



来源:https://stackoverflow.com/questions/24869182/can-i-get-open-graph-page-with-feed-from-the-api

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!