API Get Limit 500?
Hi Folks,
I am trying get items in app by using following function with offset parameter 501 and its giving error of limit.
- Can we get only 500 items through API?
- Is there way to increase this limit?
- If its limit cannot increase then how we can get more than 500 records in python?
podio.Application.get_items(222522222, limit="505", offset="501")
PFB Error Logs
items = c.Application.get_items(222522222, limit="505", offset="501")
File "C:\Users\waleed.amjad\PycharmProjects\pythonProject17\venv\lib\site-packages\pypodio2-0.2-py3.7.egg\pypodio2\areas.py", line 232, in get_items
File "C:\Users\waleed.amjad\PycharmProjects\pythonProject17\venv\lib\site-packages\pypodio2-0.2-py3.7.egg\pypodio2\transport.py", line 145, in __call__
File "C:\Users\waleed.amjad\PycharmProjects\pythonProject17\venv\lib\site-packages\pypodio2-0.2-py3.7.egg\pypodio2\transport.py", line 215, in _handle_response
pypodio2.transport.TransportException: TransportException({'date': 'Sun, 23 Jan 2022 19:28:55 GMT', 'content-type': 'application/json; charset=utf-8', 'content-length': '289', 'connection': 'keep-alive', 'server': 'nginx', 'x-rate-limit-remaining': '228', 'x-rate-limit-limit': '250', 'x-podio-auth-ref': 'user_5238600', 'x-podio-request-id': 'DmrtErkI', 'status': '400'}): {"error_parameters":{},"error_detail":null,"error_propagate":false,"request":{"url":"http:\/\/api.podio.com\/item\/app\/26151355\/","query_string":"limit=505&offset=501","method":"GET"},"error_description":"Invalid value 505 (integer): must not be larger than 500","error":"invalid_value"}
-
limit is indeed max 500 so first run is 0==> 500 en then next run 501==> 1000 etc ...you get each run a return value of how many items you get in your JSON, once it is less than 500 you reached the end, so you need a "while" or "for" construction to fetch them all in different gets ...
-
Hi Marc Decroos,
Thanks for responding, I am using while loop for it already but for first run 0==> 500 it fetches JSON of 500 but when it tries to fetch 501==> 1000 it start giving error "Limit must not be larger than 500", What I am doing is I am getting on the basis of Limit and Offset, for first run of loop they set as Limit = 500 and Offset=0, for second run these are being set as Limit = 1000 and Offset=501 where I got this error.
-
like the error indicates, limit is always smaller than 500, so keep it at 500 or 100 per fetch ... offset indicates you are requesting 501-1000 or 501-600, then 601-700 , etc ....just increment "offset" , not "limit" , keep that value at the number of records to fetch (max 500 at a time)
-
Hi Marc Decroos, This works for me, Thanks for your response and Thanks for helping me.
Please sign in to leave a comment.
Comments
5 comments