【问题标题】:Graph API Batch Request with dependencies and increment?具有依赖关系和增量的图形 API 批处理请求?
【发布时间】:2012-11-24 00:33:14
【问题描述】:

我想做一个批处理请求并使用依赖项,但我需要增加我收到的 id。正如您在下面看到的,我尝试了一些不同的想法,但它们不起作用。有没有人让这个工作?

var q = {batch:[{"name":"get-friends", "method":"GET","relative_url":"me/friends","omit_response_on_success": false},
                {"method":"GET","relative_url":"/?ids={result=get-friends:$.data[*].id}"},
                {"method":"GET","relative_url":"{result=get-friends:$.data[*].id}/mmxstaging:watch"},
                {"method":"GET","relative_url":"/mmxstaging:share?ids={result=get-friends:$.data[*].id}"}]};

FB.api('/', 'post', q, function(response) {
    console.log(response);
});

【问题讨论】:

    标签: facebook facebook-graph-api facebook-batch-request


    【解决方案1】:

    您找到解决方案了吗?如果不是,这是我的解决方案:

    var q = {batch:[{"name":"get-friends", "method":"GET","relative_url":"me/friends","omit_response_on_success": false},
                {"method":"GET","relative_url":"/?ids={result=get-friends:$.data.*.id}"},
                {"method":"GET","relative_url":"{result=get-friends:$.data.*.id}/mmxstaging:watch"},
                {"method":"GET","relative_url":"/mmxstaging:share?ids={result=get-friends:$.data.*.id}"}]};
    
    FB.api('/', 'post', q, function(response) {
        console.log(response);
    });
    

    我已经用其他代码进行了测试,它可以工作,它会获取朋友,然后自动遍历每个朋友 ID 并为我完成任务。

    如果您需要任何其他帮助,请告诉我。

    P.S 很抱歉提出这个老问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-01-10
      • 2022-01-26
      • 2015-05-11
      • 2023-02-09
      • 1970-01-01
      • 2022-06-11
      • 2018-11-28
      相关资源
      最近更新 更多