Try 30 days of free premium.

Suggestions for /schedule calls.

damiankw wrote 6 years ago: 1

Hey, thanks for the fantastic resource for material! I'm in the middle of building a small application which is based around new/unaired television series, and in order to get the information from tvmaze I need to do quite a lot of API calls, I was wondering if there's any visibility in the future of adding a couple of features to the scheduling?

Suggestion 1: Add a date range to /schedule. This could be in the form of /schedule?start=:date&end=:date, so users can pull detail for a range of dates at once. At the moment if I want to create a cache in the past, I would need to loop through all of the days I want to pull (eg, every day in September) and call the API for each one.

Suggestion 2: Add a season/episode(number) to /schedule. This one might not be used as much by anyone, but it allows easily visibility of new series starting, or new seasons starting. Again, could be in the form of /schedule?season=:season&episode=:episode

I also have one question which I don't fully understand. In /schedule output it has output['show'] for the series information. In /schedule/full it has output['_embedded']['show'] for the series information, what's the reason for having _embedded? (or could this simply be something that's pulling in the language I'm using..)

Thanks!


gazza911 wrote 6 years ago: 1

1. Whilst it may be useful, this probably won't happen as you can't cache the results when there's so many possibilities. Caching is used to ensure that the API isn't slow by having a copy of the response that it can quickly retrieve and send to you.

2. You can use this: http://www.tvmaze.com/api#episode-by-number

3. On the schedule endpoint you're returning episodes; the show's that those episodes are on are included for reference.

It's embedded because the show is not a child of episode. So it wouldn't make sense for it to be a property of it.

ankitsingh wrote 6 years ago: 1

hello,

currently new in api but i want to know that how to get the year like

1) when it was aried year and if it is running then now and if not then last date

eg: if running (2012 - now) and if not (2012 -2015)

in api i think there is no api for that plz make one


gazza911 wrote 6 years ago: 1

Hi ankitsingh,

It would probably have been better to create a new thread, but I'll answer here anyway.

You can do all this from one endpoint: http://api.tvmaze.com/shows/1/seasons

1. Get the premiereDate property from the first season and do a substring to get the first 4 characters.

2. Get the endDate property from the last season and check if it is greater than today's date

a) If greater then write out 'Now'
b) If not, do a substring to get the first 4 characters

If you want to check if there's more episodes without the airdate filled in you should use the http://api.tvmaze.com/seasons/1/episodes endpoint to check it.


david wrote 6 years ago: 1

@damiankw Great catch for spotting the discrepancy in schedule embedding! I'm aware of it, but now that it's out there it's impossible to change it without breaking everyone's code. It'll be fixed if & when we have to introduce versioning anyway.

Both #1 and #2 indeed won't happen in the public API, for reasons gazza already explained: providing filters such as these would be much more resource intensive for us, which we can't afford to offer for free.

Try 30 days of free premium.