How request more vod using pagination: cursor

Hi, how do request more VODs from the twitch api?

Using postman: GET : https://api.twitch.tv/helix/videos/?user_id=23161357 with client id in the headers.

This is what I get at the bottom of the response from the json.
“pagination”: {
“cursor”: “eyJiIjpudWxsLCJhIjp7Ik9mZnNldCI6MjB9fQ”
}

How do I use “cursor” to get the next batch of VODs?
Is there a way to start retrieving the oldest vods first instead of the most current?

Thanks.

You can add a query parameter called first and change it’s value between 1 and 100. This is basically the limit parameter from the Kraken API and can return more results per page. To get the next page, make the request again but adding a query parameter called after in the request with the cursor value from the first response and repeat as needed. You can also get the previous page by adding a query parameter called before with the cursor value.

Right now, videos can only be sorted by time (newest to oldest), trending (basically popularity), and views (from highest to lowest).

1 Like

Hey Six, thanks for answering. Im still stuck though I tried both before and after, but I’m still getting the same response …where did I go wrong?

before and after are query parameters. they don’t belong in the header

https://api.twitch.tv/helix/videos/?user_id=23161357&after=eyJiIjpudWxsLCJhIjp7Ik9mZnNldCI6MjB9fQ

1 Like

oh haha, gotcha. Thanks it works now ^^

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.