php - Error You have made too many requests recently. Please, be chill. in Asana API -


I tried to send only 5 calls to fetch tasks from Asana API. Here is my code

  $ tasks = $ client- & gt; Obtain ('https://app.asana.com/api/1.0/workspaces.json'); Print_r ($ functions); $ I = =; While (isset ($ function ['result'] ['data'] [$ i] ['id'])) {$ tasks_detail = $ client- & gt; Obtain ('https://app.asana.com/api/1.0/workspaces/'.tasks['result'[[data'[[[$$ ]['id'].'.json'); Print_r ($ tasks_detail); While (isset ($ tasks_detail ['result'] ['data'] [$ i] ['id'])) {$ tasks_details = $ client-> Receive ('https://app.asana.com/api/1.0/tasks/'.$tasks_detail['result'[[data'[[[$$ ]['id'].'.json'); Print_r ($ tasks_details); $ I ++; }  

I used only 2 while loop to fetch tasks from the API, after which the API did not respond to the call.

Consider this situation:

  $ jobs ['result '] [' Data '] [$ I] [' id ']  

exists and

  $ work_date [' result '] [' data '] [$ I] [' id ']  

does not exist.

Since $ I will never be a big loop; Consider this situation:

  $ work ['result'] ['data'] [1] ['id']  

exists and ['Data'] [1] ['id'] $ work_date ['result'] ['data'] [2] ['id'] $ work_digitation ['result'] ['data'] [ 3] ['id']

is present.

The next loop will access you

  $ work ['result'] ['data'] [4] ['id']  

direct and lost

  $ work ['result'] ['data'] [2] ['id'] $ work ['result'] ['data'] [ 3] ['id']  

.

You may want to do something like this:

  while (isset ($ work ['result'] ['data'] [$ i] ['id'] )) {$ Tasks_detail = $ client- & gt; Obtain ('https://app.asana.com/api/1.0/workspaces/'.$tasks [' Result '] [' Data '] [$ i] [' id '].' Json '). Print_r ($ tasks_detail); If (isset ($ tasks_detail ['result'] ['data'] [$ i] ['id'])) {$ tasks_details = $ client- & gt; Receive ('https://app.asana.com/api/1.0/tasks/'.$tasks_detail['result'[[data'[[[$$ ]['id'].'.json'); Print_r ($ tasks_details); } $ I ++; }  

Please be careful to end the loop, when you use while loop.


Comments