Lists Filtered To "Collected" Via API

Hi All,
So I’m trying to call a list and receive only the items that are “collected”…
Normally if I hit the URL it should look something like this - https://trakt.tv/users/sample/sample_favorites?hide=collected&sort=rank,desc
By hitting the API it would look something like this:

LIST_URL = 'https://api.trakt.tv/lists/sample/items/movies?sort=collected&limit=3'

# Headers for the API request
headers = {
    'Content-Type': 'application/json',
    'trakt-api-version': '2',
    'trakt-api-key': API_KEY,
    'X-Sort-By': 'collected',
    'X-Sort-How': 'desc'
}

def fetch_list(list_url):
    response = requests.get(list_url, headers=headers)

This however delivers everything and not only the collected items - I assume I may need to be resolving my user somehow (and not that its coming via the API key?)

Ive been playing for a while and cant work it out - if anyone would have any insights it would be enormously appreciated!

You’ll need to sort or filter the list in your app. The API docs have more details.

I had assumed this would be the case - problem is I would see two approaches to this:

  1. within the payload there’s some kind of data related to if the item is “collected” true/false - even with extended=full I see an enormous amount of data but nothing related to collected to use for filtering
  2. with X-Sort-By collected I assumed I could take the first 3 / last 3 to get collected and uncollected films but when using the X-Sort-By (even with something like title) it doesn’t seem to change the sorting order of the list

If either of these assumptions are correct, could someone perhaps guide me where I’m going wrong on the call to get it within the payload or how to have the sorting work in the headers?

Lists don’t support sorted results, the headers are read only and so you can apply sorting in your app. You would need to sync the collection data separately and use that to apply sorting on the list, in your app’s logic.