A quick question about V5`s Get multiple feed posts.
If I use limit , lets say 1, the first response will have 1 post in it and a cursor. But next request with limit=1&cursor=‘cursor from first response’ will return an empty “posts” array in the response. Isn’t it a bug?
And if I use limit=2&cursor=‘1st cursor’ - I will get one post in response.
So if I fetch posts one by one i should always increment the limit parameter in each subsequent request.
How can I fetch more then 100 posts from a channel feed in this case?
Limit is referring to how many posts you want within’ a single request. This value should not change or increment unless you want to for some odd reason. The cursor that is returned will be the next position in a list.
If you make a request with limit=1 then fetch the data. Only one piece of data will be returned as well as the cursor which can be used in your next request so you can start where you left off. So you would then proceed to make another request keeping limit=1 and update the cursor which will tell Twitch to give you the next piece of data in the list where you left off at and so on.
If you wish to obtain the most amount of data within’ a single request use limit=100. That will return 100 pieces of data along with a cursor. Then make another request after that keeping limit=100 and updating the cursor so you can then obtain the next 100 pieces of data in the list.
If the array in the response is empty then that most likely means there is no more data to return.
In your case when you made the first request using limit=1 and got 1 piece of data back, you then proceeded to make another request and it return an empty array. However, when you made a request using limit=2 and only got back 1 piece of data. That just tells you there was really only 1 piece of data total. So if you were to have made another request after the first limit=2 you most likely would have gotten an empty array as well.
Hopefully that helped!
Side note: Feed and pulse is going away
So if you are trying to archive or whatever, you’ll need to be quick about it before the API is also gone for it!
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.