Open beheh opened 2 years ago
Sounds like this should be a API Bug and not a documentation bug.
Since the API should be consistent on how it reports and use pagination.
Rather than some endpoints using after
and some using cursor
As TwitchCLI reports:
twitch api get 'extensions/live?extension_id=h6dtaffesjnw2704mr5om5dppejukg'
Error unmarshalling body: json: cannot unmarshal string into Go struct field APIResponse.pagination of type models.APIPagination%
Which suggests it's actually an API bug as the model the Twitch CLI has is correct.
Brief description The documentation for
https://dev.twitch.tv/docs/api/reference#get-extension-live-channels
(/helix/extensions/live
) states that the pagination should use theafter
parameter. This does not work. A little bit of experimentation later, and the parameter is actually namedcursor
.You can try this yourself by fetching a popular extension such as
https://api.twitch.tv/helix/extensions/live?extension_id=h6dtaffesjnw2704mr5om5dppejukg
and trying to call it with an?after=
parameter. You will notice that the server ignores this parameter and returns the same payload with the same cursor again.Expected documentation
Screenshots
Additional context or questions
I'd like to call out that this endpoint highlights inconsistencies in the new Twitch API:
/extensions/live
endpoint is the only endpoint in the new API where the cursor is directly keyed as pagination:{pagination: "<cursor>"}
. All the other paginated endpoints use the schema{pagination: {cursor: "<cursor>"}}
/extensions/live
all other paginated endpoints use?after
instead of?cursor
, except for the/hypetrain/events
endpoint. These two endpoints seem to be uniquely special, which they should probably not be.As a first step obviously the documentation issue above should be corrected. But I would suggest investigating if this endpoint (and apparently the Hypetrain endpoint) can be unified to both cleanly respect the
?after
parameter (instead of?cursor
) and for the Extensions endpoint to switch to a wrappedpagination
object.