I’m running into an issue on the videos endpoint where the helix API gives me a cursor to query more data but barks at me if I try:
GET /helix/videos?first=100&type=archive&language=en&period=month&game_id=499003&sort=trending
> {'pagination': {'cursor': 'eyJiIjpudWxsLCJhIjp7Ik9mZnNldCI6MTAwfX0'}, 'data': [100]}
GET /helix/videos?first=100&type=archive&language=en&period=month&game_id=499003&after=eyJiIjpudWxsLCJhIjp7Ik9mZnNldCI6MTAwfX0&sort=trending
> {'pagination': {'cursor': 'eyJiIjp7Ik9mZnNldCI6MH0sImEiOnsiT2Zmc2V0IjoyMDB9fQ'}, 'data': [100]}
GET /helix/videos?first=100&type=archive&language=en&period=month&game_id=499003&after=eyJiIjp7Ik9mZnNldCI6MH0sImEiOnsiT2Zmc2V0IjoyMDB9fQ&sort=trending
> {'pagination': {'cursor': 'eyJiIjp7Ik9mZnNldCI6MTAwfSwiYSI6eyJPZmZzZXQiOjMwMH19'}, 'data': [100]}
GET /helix/videos?first=100&type=archive&language=en&period=month&game_id=499003&after=eyJiIjp7Ik9mZnNldCI6MTAwfSwiYSI6eyJPZmZzZXQiOjMwMH19&sort=trending
> {'pagination': {'cursor': 'eyJiIjp7Ik9mZnNldCI6MjAwfSwiYSI6eyJPZmZzZXQiOjQwMH19'}, 'data': [100]}
GET /helix/videos?first=100&type=archive&language=en&period=month&game_id=499003&after=eyJiIjp7Ik9mZnNldCI6MjAwfSwiYSI6eyJPZmZzZXQiOjQwMH19&sort=trending
> {'pagination': {'cursor': 'eyJiIjp7Ik9mZnNldCI6MzAwfSwiYSI6eyJPZmZzZXQiOjUwMH19'}, 'data': [100]}
GET /helix/videos?first=100&type=archive&language=en&period=month&game_id=499003&after=eyJiIjp7Ik9mZnNldCI6MzAwfSwiYSI6eyJPZmZzZXQiOjUwMH19&sort=trending
> {'pagination': {'cursor': 'eyJiIjp7Ik9mZnNldCI6NDAwfSwiYSI6eyJPZmZzZXQiOjYwMH19'}, 'data': [100]}
GET /helix/videos?first=100&type=archive&language=en&period=month&game_id=499003&after=eyJiIjp7Ik9mZnNldCI6NDAwfSwiYSI6eyJPZmZzZXQiOjYwMH19&sort=trending
> {'error': 'Bad Request', 'status': 400, 'message': '{"error":"Invalid value for offset: 600","message":"Invalid value for offset: 600","status":400}'}, arguments were: {'params': {'first': 100, 'type': 'archive', 'language': 'en', 'period': 'month', 'game_id': '499003', 'after': 'eyJiIjp7Ik9mZnNldCI6NDAwfSwiYSI6eyJPZmZzZXQiOjYwMH19', 'sort': 'trending'}}
The “Invalid value for offset: 600” could be explained if the “cursor” would just be an encoded offset, because the error occured on the 7th call, which would have been offset 600. All the results contained 100 results, which indicates there being more results to query.
My current workaround would be to just not query that much data, since I don’t really need that much, and just assume the cursor is over if it starts giving me these weird errors.