Facebook Graph API Post with_tags option

Deadly 提交于 2019-12-18 05:19:06

问题


I'm experiencing an issue with http://developers.facebook.com/docs/reference/api/post/. Namely, option called "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.


回答1:


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

**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/




回答2:


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://stackoverflow.com/questions/11614574/facebook-graph-api-post-with-tags-option

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