2012-02-17 26 views
1

我想做一個批處理請求並使用依賴關係,但是我需要增加我收到的ID。正如你可以看到下面,我已經嘗試了幾個不同的想法,但他們不工作。任何人都可以得到這個工作?帶有依賴性和增量的圖形API批處理請求?

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

回答

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對不起碰到這個老問題。