API Pagination cursor loops - Ban events & Banned users

Hello,

Using these endpoints :

  • Ban events GET https://api.twitch.tv/helix/moderation/banned/events
  • Banned users GET https://api.twitch.tv/helix/moderation/banned

I’m trying to get all the users banned on a channel, here is my code :

// nodeJS
const axios = require('axios');

function requestBans(cursor) {
    axios.get((cursor ? BASE_URL + `&after=${cursor}` : BASE_URL), {
            headers: {
                'Authorization': 'Bearer TOKEN',
                'Client-Id': 'CLIENT_ID'
            }
        })
        .then((res) => {
            if (res.data && res.data.data && res.data.pagination && res.data.pagination.cursor) {
                
                // Logging the users in the database

                setTimeout(() => {
                    requestBans(res.data.pagination.cursor);
                }, 3.5 * 1000);
            }

        })
        .catch((error) => {
            console.error(error.message)
        });
}

requestBans();

However at some point the cursor doesn’t update itself, it stays the same and the requests start looping (after about 500 users). I’m trying to get very old bans I’m not sure if that changes anything.

I’ve tried both endpoints multiple times sometimes the pagination doesn’t even work, I’ve seen a few topics about pagination looping but nothing helped me. The looping cursor : eyJiIjp7Ik9mZnNldCI6MTIwfSwiYSI6eyJPZmZzZXQiOjE2MH19

Also I know for a fact that there are more than 10k users currently banned on this channel using logs I’ve gathered over the last years using the moderation pubsub. But I’m trying to get older bans from before my pubsub log setup.

Well thank you very much I guess, I thought it had been repaired since then, as some dev answered in the forum post linked to this issue. I guess this really puts such statements into perspective Jebaited

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