1

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);
});
Jeremy
  • 1
  • 85
  • 340
  • 366
kentendo
  • 31
  • 5

1 Answers1

1

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.

Syed I.R.
  • 6,180
  • 2
  • 29
  • 41