The Movie Database atbalsts

This is just a suggestion which I don't expect will happen, due to the low priority of it, but it could be good for bandwidth.

Currently, if you request this URL:
http://api.themoviedb.org/3/movie/25657

You get this ETag:
W/"29b21c33f5540e8be9ab71e728157422"

If you request the same film, but append to the response, various other information, like this:
http://api.themoviedb.org/3/movie/25657?append_to_response=alternative_titles,credits,images,keywords,releases,videos,similar

You get this ETag:
W/"29b21c33f5540e8be9ab71e728157422"

The same ETag.

Now, the method name says it all, you are taking the initial response and the initial ETag and appending to it.
That said, it would be nice if append did change the ETag.
Thus, when you request all the information, you can just do a HEAD call to get the ETag and see if it has changed, rather than having to download it all to check.

How many people actually do HEAD requests? Probably just me. Thus the low prioirty. It would be nice though! :P

23 replies (on page 1 of 2)

Jump to last post

Nākamā lapaPēdējā lapa

I could have sworn way back when, I added proper support for ETag's and append_to_response.

Digging... aha, yes, it did work at one point but as pointed to on this thread broke in ~2013 sometime. It completely fell off my radar.

The stack is quite different today than it was in 2013, I suspect it might not be too hard to add back now. I have a lot of small stuff like this piling up, I'll try to set aside a week here and there and get issues like this knocked off.

P.S. I'm not sure how useful the similar method is anymore, I've moved everything over to recommendations myself. Just a heads up wink

I find "known for" or "best known for" is fairly computable. Attempts at "similar" that I have seen have best been left to human input.

This is supported properly now on the media methods. It's not hooked up on list methods (search, discover, etc..) but may at some point. It's less useful there anyways since so much of that data changes.

Anyways, you can use it the way you wanted above smiley

Awesome! Will be really handy considering how many films there are and many of which will never get updated.

Does the order you put the append additions in the URL API call impact the eTag? Or does it ignore order (hopefully)?

As long as the ETag is the same it will work. Based on my simple test it looks both calls return the same ETag which means we're good:

$ curl -I -L 'http://api.themoviedb.org/3/movie/550?api_key=###&append_to_response=videos,images'
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: ETag, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, Retry-After
Cache-Control: public, max-age=28800
Content-Length: 1667
Content-Type: application/json;charset=utf-8
Date: Fri, 16 Mar 2018 19:25:53 GMT
ETag: "eae7ea14049e04d9e4e56d16244d46c8"
Server: openresty
Vary: Accept-Encoding
X-Memc: HIT
X-Memc-Age: 23562
X-Memc-Expires: 5238
X-Memc-Key: a7a8be33582080c3e162cfcb93607b73
Connection: keep-alive

$ curl -I -L 'http://api.themoviedb.org/3/movie/550?api_key=###&append_to_response=images,videos'
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: ETag, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, Retry-After
Cache-Control: public, max-age=28800
Content-Length: 1667
Content-Type: application/json;charset=utf-8
Date: Fri, 16 Mar 2018 19:26:00 GMT
ETag: "eae7ea14049e04d9e4e56d16244d46c8"
Server: openresty
Vary: Accept-Encoding
X-Memc: HIT
X-Memc-Age: 23569
X-Memc-Expires: 5231
X-Memc-Key: a7a8be33582080c3e162cfcb93607b73
Connection: keep-alive

Great!

Can actually make good use of the HEAD command now, rather than GET :D

Okay, so I finally got around to fiddling with this.

If I call this: https://api.themoviedb.org/3/movie/2?api_key=xxx&append_to_response=alternative_titles,credits,images,keywords,releases,videos,similar";

I get an eTag of: W/"79894c6a8a69f6515f26de9e031382c5

If I call this: https://api.themoviedb.org/3/movie/2?api_key=xxx&append_to_response=alternative_titles,credits,images,keywords,releases,videos";

I get an eTag of: W/"79894c6a8a69f6515f26de9e031382c5

I was kinda hoping they would be different!

Is this working as intended?

Now obviously, I am not planning on changing what I am asking for all the time. I just decided I didn't need "similar" and it increases the size quite a bit and there is no point doing it if I am not using it. That said, I wasn't expecting the eTag to remain the same.

The ETag should be a value computed on response body so yes, it looks like it's a bug. I'll have to take a look. I've created a new ticket for this here.

Remember to make sure the order of the append_to_response comma delimited string does impact the eTag.

I remember you saying that you order them and thus avoiding the issue. Just thought I would mention it though.

Remember to make sure the order of the append_to_response comma delimited string does impact the eTag.

does or doesn't? It won't since the order of the query params does not change the response body. The only thing that would create a new ETag would be a different SHA of the response body.

That should be fine.

e.g. you should an example above of it working, but that said, the append choices don't make much odds at the moment :)

The way you describe it though, there should be no issue.

Is the ETA on this one sooner or later?

Any information on the matter would help me plan accordingly!

Thanks.

Hey Adi,

I'll try to find time to look into this tomorrow.

Just noticed that the eTag for Ariel (ID:2) has changed. It hasn't been edited since February though. Doesn't have any reviews.

Does this change every time something like popularity is recalculated or when someone adds a vote, the eTag changes?

Can you still add a vote?

If it is just popularity, how often is that calculated?

Obviously, an eTag is just an MD5 hash of the data. So it is what it is.

Makes me hanker for an X-Data-eTag to indicate manual changes to the data, rather than automated one. e.g. if someone adds a review, votes up an image, you want that change. Having popularity changed, especially if it is on a schedule, less so.

Obviously, such thinking opens up a whole different can of worms.

Vai nevarat atrast filmu vai TV pārraidi? Piesakieties, lai to izveidotu.

Vispārējs

s fokusējiet meklēšanas joslu
p atveriet profila izvēlni
esc aizveriet atvērtu logu
? atveriet īsinājumtaustiņu logu

Mediju lapās

b atgriezties (vai pie vecākiem, ja nepieciešams)
e dodieties uz rediģēšanas lapu

TV sezonas lappusēs

(labā bultiņa) pāriet uz nākamo sezonu
(kreisā bultiņa) pāriet uz iepriekšējo sezonu

TV epizodes lappusēs

(labā bultiņa) pāriet uz nākamo sēriju
(kreisā bultiņa) pāriet uz iepriekšējo sēriju

Visās attēlu lapās

a atveriet attēla pievienošanas logu

Visās rediģēšanas lapās

t atvērt tulkošanas atlasītāju
ctrl+ s iesniegt formu

Diskusiju lapās

n radīt jaunu diskusiju
w pārslēgt skatīšanās statusu
p pārslēgt publisko/privāto
c pārslēgt aizvērt/atvērt
a atklāta darbība
r atbilde uz diskusiju
l dodieties uz pēdējo atbildi
ctrl+ enter iesniedziet savu ziņojumu
(labā bultiņa) nākamajā lapā
(kreisā bultiņa) iepriekšējā lapa

Iestatījumi

Vai vēlaties novērtēt vai uzskaitīt šo vienumu?

Pieslēgties