Try 30 days of free premium.

feature request: add show id and season id to episodes and seasons enpoints

or_dvir wrote 5 years ago: 1

i can see that there is a similar thread here: https://www.tvmaze.com/threads/3322/feature-request-user-api-add-showid-to-get-userepisodes but its asking about a different endpoint, and also the specific problem was solved by another way.

i want to be able to associate a season to its show, and an episode to its season and show.

i know that in most endpoint the show id is already a part of the request... but there are some where that information is not available. for example the "season episodes" endpoint.
another example is that if i use "show episode list" (http://api.tvmaze.com/shows/1/episodes) i dont have information about seasons.

sure i can also embed seasons into the request and cross-reference the information but it just seems like too much work for a very simple thing. also embedding both seasons and episodes in the same request increases network traffic, server runtime and response time, and size of the result. this could all be avoided by simply adding 2 fields...

is it possible to add the following?
-for seasons: needed showId field
-for episodes: needed showId and seasonId fields


gazza911 wrote 5 years ago: 1

What exactly is the reasoning behind this?

In order to get the season ID so that you can call the seasons episodes endpoint, you first need to call the seasons endpoint, http://api.tvmaze.com/shows/1/seasons or similar, in which case you already have the Show ID in the URL.

or_dvir wrote 5 years ago: 1

gazza911 wrote:
What exactly is the reasoning behind this?

In order to get the season ID so that you can call the seasons episodes endpoint, you first need to call the seasons endpoint, http://api.tvmaze.com/shows/1/seasons or similar, in which case you already have the Show ID in the URL.

while what you say is true, it means i have to remember past requests and/or pass that information along a bunch of places in my app (for example from the show screen to the season screen to the episodes screen). while not being that big of a deal, its annoying and increases the potential for errors and bugs.

my specific case is this:

i use ".../shows/{showId}?embed[]=seasons&embed[]=episodes" because i want to get it all in one request. after i get the result i am saving it to a local DB where i have a table for shows, a table for seasons, and a table for episodes. at a later stage, i might want to retrieve all seasons for a specific show or all episodes for a specific season/show. in order to do that i have to include in my seasons table a "show id" column and in the episodes table 2 more columns: "show id" and "season id".

at the moment in my server request callback, before putting all this data in my local DB, i have to manually set these values using something like this: forEach(season) { season.setShowid = requestShowId } and also forEach(episdoe) {episode.SetShowId = requestShowId}. however for setting the season id for an episode its a little more complicated: forEach(episode) { forEach(seasons) { if(seasonNumber = episode.seasonNumber) then episode.SeasonId = season.id) } }

i hope this pseudo code is clear... as you can see i have to iterate every single season and every single episode just to set a simple small value (showId). and in the case of episodes, i even have nested loops. it just seems unnecessary in terms of coding and runtime.

remember that some shows have thousands if not 10,000+ episodes and i need to do this for every single show... it would be much easier and more efficient if i could simply get the result and dump it all straight to my local DB.

this is my very specific use case but im sure there are other situations where similar arguments could be made.

is it really that difficult/complicated to add these couple of fields?

Try 30 days of free premium.