Forum Discussion

hexitated's avatar
hexitated
Helper I
5 years ago

How to handle Pagination/Limiting while getting Data from an API

Hey, I have an issue and hope you can help me on that.

My data comes from an api that only allows to get 200 projects with one API-Call.

Since we have around 1500 Projects I have to increment the offset by 200 till 1400 obviously.

So far I made 8 different requests and than summed these together to one request. I think thats not a great method and pretty static.

But I haven't found a solution for that so far. I have to put in a limit to the request because else it will return "400".

That why it does not show me any results if I leave out the limit/offset

 

Is there a possibility to add all of these 8 requests (with increasing offseat) directly into 1? When I try it with "..url.. & ..url.. & ..url.." it wouldn't work as well.

 

My API-Request links are looking like that:

 

https://api.x.net/subprojects?status[neq]=1&status[neq]=2&status[neq]=6&status[neq]=8&offset=0&limit=200

https://api.x.net/subprojects?status[neq]=1&status[neq]=2&status[neq]=6&status[neq]=8&offset=200&limit=200

https://api.x.net/subprojects?status[neq]=1&status[neq]=2&status[neq]=6&status[neq]=8&offset=400&limit=200

 

and so on..

 

Best regards