javascript Facebook Graph API Post with_tags 选项
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11614574/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Facebook Graph API Post with_tags option
提问by OutWard
I'm experiencing an issue with http://developers.facebook.com/docs/reference/api/post/. Namely, option called "with_tags".
我遇到了http://developers.facebook.com/docs/reference/api/post/的问题。即,称为“with_tags”的选项。
options = {
"message": "Test123",
"with_tags": {
"data":[
{"id": 100001686722916, "name": "Aret Aret"}
]
}
};
FB.api('/me/feed', 'post', options, function(response) {
if (!response || response.error) {
alert('Error occured');
console.log(response);
} else {
console.log(response);
}
});
As a result, I just get a message "Test123" but no "with" tags in my post. The user I use in "with" section is on my friends list and is a developer of the app as well. Thanks.
结果,我只收到一条消息“Test123”,但我的帖子中没有“with”标签。我在“with”部分使用的用户在我的朋友列表中,并且也是该应用程序的开发人员。谢谢。
回答by TommyBs
I actually think the "with_tags" option is read only when returning the feed object. It's not an option you can POST https://developers.facebook.com/docs/reference/dialogs/feed/#graphapicall.I think what you want to use is just "tags" and it should just contain id's as specified here https://developers.facebook.com/docs/reference/api/user/#posts
我实际上认为“with_tags”选项仅在返回提要对象时才被读取。这不是您可以发布https://developers.facebook.com/docs/reference/dialogs/feed/#graphapicall的选项。我认为您想要使用的只是“标签”,它应该只包含此处指定的 id https ://developers.facebook.com/docs/reference/api/user/#posts
**note you cannot do this though without also specifying a place
**请注意,如果不指定地点,您将无法执行此操作
EDIT**** Facebook have now released mention tagging which might be the solution you need https://developers.facebook.com/docs/opengraph/mention_tagging/
编辑**** Facebook 现在发布了提及标签,这可能是您需要的解决方案 https://developers.facebook.com/docs/opengraph/mention_tagging/
回答by tixastronauta
Here's an example on how to publish to user feed while tagging some friends:
这是一个关于如何在标记一些朋友的同时发布到用户提要的示例:
FB.api(
"/me/feed",
"POST",
{
"message": "This is a test message",
"place": "link",
"tags": "friend_id1,friend_id2"
},
function (response) {
if (response && !response.error) {
console.log(response); /* post id will be returned */
}
}
);
From: https://developers.facebook.com/docs/graph-api/reference/v2.5/user/feed
来自:https: //developers.facebook.com/docs/graph-api/reference/v2.5/user/feed