GeezerVison is showing github.com — Update the public ChannelMetadata viewset to support token filter · Issue #5462 · learningequality/studio
Update the public ChannelMetadata viewset to support token filter #5462Description

❌ 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.
Activitychanged 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, 2025AlexVelezLl commented on Aug 25, 2026 We ended up implementing this in the v1 viewset for ESoCC. More investigation will be needed for Admin Resource Discovery.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|