filters on data requested

insomniac2846 wrote 9 years ago: 1

I was wondering if there was a way to filter the results endpoints give back. For example a way to talk to the /shows endpoint and say we only want the show ids?

Thanks!


gazza911 wrote 9 years ago: 1

No, you can't request less than the default.

I'm not part of TVMaze (so this isn't official), but if you provide some insight into why you'd want/require it then they might consider it.

srob650 wrote 9 years ago: 1

How is it that you are interacting with the endpoints? This can be accomplished really easily using my Python interface to the API:

>>> import pytvmaze
>>> shows = pytvmaze.get_show_list('utopia')
>>> ids = [show.maze_id for show in shows]
>>> ids
[64, 3300, 153, 15569, 18752, 18917, 5421, 16136, 17958, 21018]

srob650 wrote 9 years ago: 1

It occurs to me that you may have meant the full show index, not a show search. If this is the case, just replace line 2 with:

>>> shows = pytvmaze.show_index()

Note that this only gets page 1 of the full list of shows. You can get different pages by doing:

>>> shows = pytvmaze.show_index(page=2)

You can find the code here if you want to look deeper :) https://github.com/srob650/pytvmaze


david wrote 9 years ago: 1

This isn't possible on the API level, though you can always do so on the client side like srob650 suggested.

But for the specific usecase of retrieving all the available show ID's, you could check out the updates endpoint.

insomniac2846 wrote 9 years ago: 1

I figured out what i needed with /update/shows. In general, it'd be great way to save some bandwidth if I know my code is only going to use certain field and ignores others.

Try 30 days of free premium.