Skip to content

Update the public ChannelMetadata viewset to support token filter #5462

Closed as not planned

Description

@AlexVelezLl

❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Overview

After implementing the new ChannelVersion model, we need to expose a way to retrieve specific channel version metadata via the studio public API. The current endpoint that Kolibri uses to retrieve channel metadata using tokens is views_v1.get_public_channel_lookup. However, to introduce the new support for channel version tokens, some tweaks will be needed, and instead of continuing to build on top of the v1 endpoints, we will rather add support for channel tokens on the public channel v2 viewset.

Technical details

The main problem with allowing the public ChannelMetadataViewset to receive a token filter is that, if a token is passed, we need to retrieve these channels from the contentcuration models. That means, we'll need to modify the viewset get_queryset method to return the queryset of token-related channels, but these channels will come from the ContentCuration models. For this:

  • We'll need to create a get_queryset_from_token method. This method will receive a token and will build the channel queryset, fetching the Channels with the token matching one of its secret tokens, and ChannelVersions whose secret token matches the token. Then, we will need to annotate this queryset to fill the missing fields that the Viewset exposes or filters, or that have a different name in the contentcuration models. The idea is that all transformations that we do with the current queryset can be made within the context of this new queryset.
    • Note that for channel version tokens, fields like the published_size should match the specific version's published_size, not the current channel published_size, since it may be different if a new version has been released.
    • Since, for now, we don't support collections of channels with specific versions, we can assume that if we found channels in the Channel model with a given token, then we can return that queryset without checking the token in ChannelVersion.
  • Check in the get_queryset method if a token query param is present in the request; if so, return the queryset from get_queryset_from_token.
  • For now, if a token is passed, then we will disable all other filters present in the ChannelMetadataFilter. For this, we will override the filter_queryset method to return the queryset unfiltered if a token is present in the request query_params.
  • The consolidate method will also need to be upgraded to
    • Skip the included_languages computation for channels fetched via token since they are already computed in the ChannelVersion model.
    • Skip the countries array computation since it does not apply to private channels.

Finally, we should update the channel metadata test suites to test that the filter by token is working fine with channel tokens, channel version tokens, and channelset tokens.

Acceptance criteria

  • The ChannelMetadataViewSet now has support for token filtering.
  • The ChannelMetadataViewSet returns the adequate values for channel and channel version tokens.
  • New unit tests have been added to ensure that other filters keep working as expected.

Activity

  1. added
    TODO: draftIssue is a working in progress and not ready to be worked on
    on Oct 9, 2025
  2. added theissue type on Oct 9, 2025
  3. changed the title [-]Add a new v2 public lookup endpoint that supports channel version tokens[/-] [+]Update the public ChannelMetadata viewset to support token filter[/+] on Nov 26, 2025
  4. added
    P0 - criticalPriority: Release blocker or regression
    and removed
    TODO: draftIssue is a working in progress and not ready to be worked on
    on Dec 4, 2025
  5. self-assigned this
    on Jan 26, 2026
  6. removed their assignment
    on Jan 26, 2026
  7. AlexVelezLl commented on Aug 25, 2026

    @AlexVelezLl
    MemberAuthor

    We ended up implementing this in the v1 viewset for ESoCC. More investigation will be needed for Admin Resource Discovery.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P0 - criticalPriority: Release blocker or regression

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions