具有依赖关系和增量的图形 API 批量请求?

发布于 2025-01-06 05:46:44 字数 599 浏览 0 评论 0原文

我想做一个批量请求并使用依赖项,但我需要增加我收到的 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);
});

I want to do a batch request and use dependencies, but i need to increment the ids I receive. As you can see below, I have tried a few different ideas but they don't work. Anyone ever get this to work?

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);
});

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

红衣飘飘貌似仙 2025-01-13 05:46:44

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

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 并为我完成任务。

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

PS 很抱歉提出这个老问题。

Have you found the solution yet? If not here's my solution:

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);
});

I have tested with other code and it works, It gets friends and then auto goes through each friend id and does the task for me.

Let me know if you need any other help.

P.S Sorry to bump this old question.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文