Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong pagination parameter in documention for /extensions/live endpoint #524

Open
beheh opened this issue Nov 19, 2021 · 1 comment
Open
Labels
product: docs Documentation on dev.twitch.tv/docs

Comments

@beheh
Copy link

beheh commented Nov 19, 2021

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 the after parameter. This does not work. A little bit of experimentation later, and the parameter is actually named cursor.

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

cursor | string | The cursor used to fetch the next page of data.

Screenshots

image

Additional context or questions

I'd like to call out that this endpoint highlights inconsistencies in the new Twitch API:

  • On the payload site, as far as I can tell, the /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>"}}
  • On the request side, except for /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 wrapped pagination object.

@beheh beheh added the product: docs Documentation on dev.twitch.tv/docs label Nov 19, 2021
@BarryCarlyon
Copy link
Contributor

BarryCarlyon commented Nov 21, 2021

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.

iProdigy added a commit to twitch4j/twitch4j that referenced this issue Feb 10, 2022
iProdigy added a commit to twitch4j/twitch4j that referenced this issue Feb 27, 2022
* feat: implement TwitchHelix#getExtensionLiveChannels

* refactor: provide cursor workaround in optional wrapper

* feat: implement TwitchHelix#getReleasedExtensions

* feat: implement TwitchHelix#getExtensionBitsProducts

* feat: implement TwitchHelix#updateExtensionBitsProduct

* fix: properly create json body for updateExtensionBitsProduct

* fix: extensions live pagination workaround via twitchdev/issues#524

* feat: add TwitchHelix#getExtensionSecrets

* feat: add TwitchHelix#createExtensionSecret

* feat: add TwitchHelix#sendExtensionChatMessage

* feat: add TwitchHelix#sendExtensionPubSubMessage

* feat: add TwitchHelix#setExtensionRequiredConfiguration

* feat: add TwitchHelix#getExtensionConfigurationSegment

* feat: add TwitchHelix#setExtensionConfigurationSegment

* feat: add TwitchHelix#getExtensions

* refactor: reorder helix jwt endpoints

* docs: note twitch scope inconsistency with getUserExtensions

* fix: make ReleasedExtension#hasChatSupport yield Boolean

* chore: add more undocumented ExtensionState based on kraken

* refactor: use JsonProperty in ExtensionSegment

* fix: add ExtensionSegment#toString
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product: docs Documentation on dev.twitch.tv/docs
Projects
None yet
Development

No branches or pull requests

2 participants