Sprijin Bază de date filme (The Movie Database)

I found several discussions in which the feature to string together TV queries to get all of the season info and episode info for a single series using the append_to_response parameter.

/3/tv/1418?api_key=####&append_to_response=season/0,season/0/credits,season/0/external_ids,season/0/images,season/0/episode/1,season/0/episode/1/credits,season/0/episode/1/external_ids... ...,season/0/episode/1/images,season/0/episode/2,season/0/episode/2/credits,season/0/episode/2/external_ids,season/0/episode/2/images,season/0/episode/3,season/0/episode/3/credits,... ....season/0/episode/3/external_ids,season/0/episode/3/images

But I imagine this would get rather long if someone tried to get all of the season and episode information for a reasonably long series, especially if you want to include the external_ids, images, and credits/

Is there a maximum length for the append_to_response parameter? Or are we just limited to the maximum length that will be supported by the URL?

3 răspunsuri (pe pagina 1 din 1)

Jump to last post

Ya, there will be a max. There is actually a maximum length for GET requests itself. I believe Nginx limits it to 2096 bytes (characters).

It is definitely not designed to go and get every individual episode like that. Handy to be able to do a couple but the max that seems reasonable would be a single season's worth. The thing is, you're not using append_to_response the way it was intended to be used.

It is designed to be able to take a season and ask for all it's relevant details i.e.:

/3/tv/1418/season/1?append_to_response=credits,external_ids,images

That way your "season" call is 1 request.

Same goes for episodes:

/3/tv/1418/season/1/episode/1?append_to_response=credits,external_ids,images

This all makes me think there probably should be a max. I don't mind people using it to get you know, maybe 20 extra objects but your scenario you're actually making 3 calls per season (instead of my example of one) and then 3 per episode (compared to again, 1 in my example). The way append_to_response works is by simply making the calls in the background so executing a call with every method separate like this is actually a lot less efficient. (I know though, in your eyes you are making a single request but the way it builds the call in the background is different.)

The only way to fix what I see in a call like this would be to support nested append_to_response params but that is just getting crazy and is not something I'll support.

I've created a new ticket for me to look at this, it's here. I'll tell you in advance, the max per call is going to be something like 20. So you can split up your calls appropriately.

Cheers!

Thanks Travis. I actually never really planned to use it like this, the biggest I thought about was just stringing together the base season/# calls to get a list of all of the episodes, which for nearly every series I can think of would be less than 20. I just wanted to make sure they was or wasn't a limit since you theoretically could string together than many requests. I'll make sure to limit my design to 20 or fewer additional calls.

One additional question. Can you give me an idea how this would be handled server side if someone requests more than 20 (or whatever the limit ends up being? Would there be an error response of some kind or would it just return the first 20 extra objects?

And apologies in advance to anyone whose current program I broke because of this question.

Great, thanks for asking.

We would end up throwing an error similar to an invalid api key error or invalid page error. You can see what that looks like by mashing in a random string for an API key or specify a page larger than 1000.

There's an open ticket to re-add the documentation for all of the valid error codes. It used to be online but was removed when 2.1 was taken offline. It will get re-added this week.

Nu găsiți un film sau un serial? Autentificați-vă pentru a-l crea.

Globale

s focalizează bara de căutare
p deschide meniul profilului
esc închide o fereastră deschisă
? deschide fereastra cu scurtături de la tastatură

Pe paginile media

b mergi înapoi (sau la părinte atunci când este cazul)
e mergi la pagina de editare

Pe paginile sezoanelor filmelor seriale

(săgeată dreapta) mergi la sezonul următor
(săgeată stânga) mergi la sezonul precedent

Pe paginile episoadelor filmelor seriale

(săgeată dreapta) mergi la episodul următor
(săgeată stânga) mergi la episodul precedent

Pe toate paginile de imagini

a deschide fereastra pentru adăugarea de imagini

Pe toate paginile de editare

t deschide selectorul de traduceri
ctrl+ s trimite formularul

Pe paginile de discuții

n crează o discuție nouă
w comută starea de vizionare
p comută publică/privată
c comută închisă/deschisă
a deschide activitatea
r răspunde la discuție
l mergi la ultimul răspuns
ctrl+ enter trimite mesajul
(săgeată dreapta) pagina următoare
(săgeată stânga) pagina precedentă

Setări

Doriți să evaluați sau să adăugați acest articol într-o listă?

Autentificare