dongshi9489 2012-05-05 13:58
浏览 47
已采纳

从经过身份验证的用户获取Open Graph操作ID

I'm taking a first shot at the Facebook Open Graph API. I've made a custom Action Type and Object Type. For this question I'll name them "myaction" and "myobject".

function postAction(){
    FB.api(
        '/me/appnamespace:myaction?myobject=http://domain.com/page.php',
        'post',
        function(response) {
            if (!response || response.error) {
                alert('Error: ' + response.error.type + ' - ' + response.error.message);
            } else {
                //alert('Like was successful! Action ID: ' + response.id);
                var likedId = response.id;
                alert('Action was successful! Action ID: ' + response.id + ' (var = ' + likedId + ')');
            }
        }
    );
}

This works. The action is published to the user's timeline.

But if that user wants to delete that action (or multiple actions) from my site in a different session? Is there a way to query the custom actions from the user and display them? I could work with a database, and store the actionId, but that will conflict when the user has already deleted the action on facebook

The code for deleting the action would be:

function deleteAction(){
    FB.api(
        'xxxxxxxxxx',  // Here the Action ID must be inserted
        'delete',
        function(response) {
            alert('action deleted')
        }
    );
}

Edit:

This works for getting the action from a specific page (object):

function getAction(){
    FB.api(
        '/me/appnamespace:myaction?myobject=http://domain.com/page.php',
        'get',
        function(response) {
            if (!response || response.error) {
                alert('Error: ' + response.error.type + ' - ' + response.error.message);
                console.log(response);
            } else {
                console.log(response);
            }
        }
    );
}

This works for getting all the custom actions from the user:

function getAllAction(){
    FB.api(
        '/me/appnamespace:myaction',
        'get',
        function(response) {
            if (!response || response.error) {
                alert('Error: ' + response.error.type + ' - ' + response.error.message);
                console.log(response);
            } else {
                console.log(response);
            }
        }
    );
}

In short, is there a way to do this in FQL:

  • query the Object ID from the current url?
  • query the Action ID from the user (all custom Actions and/or specific action based on the Object ID)?

Thanks in advance!

  • 写回答

1条回答 默认 最新

  • dqsvnsad79721 2012-05-09 12:07
    关注

    This data is not available via FQL, it is currently only available via the Graph API. Hope it will present soon.

    See this questions:

    1. FQL to get user's open graph video.watches activity

    2. How to get all the Open Graph Beta actions generated by an app?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 plotBAPC画图出错
  • ¥30 关于#opencv#的问题:使用大疆无人机拍摄水稻田间图像,拼接成tif图片,用什么方法可以识别并框选出水稻作物行
  • ¥15 Python卡尔曼滤波融合
  • ¥20 iOS绕地区网络检测
  • ¥15 python验证码滑块图像识别
  • ¥15 根据背景及设计要求撰写设计报告
  • ¥20 能提供一下思路或者代码吗
  • ¥15 用twincat控制!
  • ¥15 请问一下这个运行结果是怎么来的
  • ¥15 单通道放大电路的工作原理