how can i set the discover api to only get movies with release date starting tomorrow and higher only, i have tried with release_date_gte and _lte and the results are all over the place, 0 sort or anything and its weird
Can't find a movie or TV show? Login to create it.
Want to rate or add this item to a list?
Not a member?
Reply by Travis Bell
on August 19, 2021 at 10:38 AM
Hi @Omara8, a few points that should help:
Default sort is by popularity. You can change this if you want by using a different
sort_by
value.Filtering with
release_date.gte
andrelease_date.lte
without aregion
is going to simply filter by the earliest release date found on a media record. So as an example, filtering starting tomorrow and ending Dec 31, you can do something like:If you don't want to target a particular region, you can do a slightly different query:
Reply by Omara8
on August 19, 2021 at 11:08 AM
have u tried this API?, it literally returns the movie black widow as first item with release date July 9th
Reply by Omara8
on August 19, 2021 at 11:12 AM
for example this is the API im running right now.
the results that are coming do include a movie like the following, which is a movie from 2020, i think you have a major content issue or a back-end issue that needs some major fixing.
Reply by Omara8
on August 19, 2021 at 11:16 AM
the more i look at the response the more i see issues there, for example i got movie #5 is releasing on August 27th, then movies 7,8 are releasing on August 20th, the sorting is also not working properly
Reply by Travis Bell
on August 19, 2021 at 11:29 AM
Sure, look at the release data we have: https://www.themoviedb.org/movie/497698-black-widow/releases#US
You can see there's a physical release date added for September 14.
If you want to add release type filtering, you'll want to add a
with_release_type
filter. This is discussed in the docs.For this query, the returned
release_date
data is not going to be theprimary_release_date.lte
/primary_release_date.gte
that you're filtering on since you're specifying aregion
. If you want to see the matched data, you will want to remove theregion
filter. If you want the region, then userelease_date.gte
andrelease_date.lte
and possibly thewith_release_type
filter. You can't mix and match primary with a region.Reply by Omara8
on August 19, 2021 at 11:37 AM
ok now now api works but from what i have seen so far the documentation are not exactly intuitive, if some fields are left optional then the developers might not even read the description to find out that if they don't add X or Y it will ruin the responses.
Reply by Omara8
on August 19, 2021 at 12:36 PM
@travisbell so i have been testing out the APIs and i am honestly thinking about implementing another service for the back-end for this project.
i am using this API right now with AND without region=US, on postman it is working properly without adding or removing "primary_" when toggling the region, for the android app it literally brings out movies dating back to 1874.
my conclusion is that the service is simply non workable with the current status to be in anything consumer related, could be used as testing service for dummy projects but that's it
what a shame.
Reply by Travis Bell
on August 19, 2021 at 12:48 PM
What region is returning a movie from 1874? I'm not seeing that here:
The first item is
2021-08-20
which seems correct and reasonable. I went through all 10 pages and couldn't find anything like that.Reply by Omara8
on August 19, 2021 at 1:34 PM
I/okhttp.OkHttpClient: <-- 200 https://api.themoviedb.org/3/discover/movie?page=1&primary_release_date_gte=2021-08-19&primary_release_date_lte=2022-12-31&sort_by=primary_release_date.asc&with_release_type=3 (1191ms, unknown-length body)
here's a screenshot of the actual response
preview
Reply by Omara8
on August 19, 2021 at 1:57 PM
the only difference i can see is that im using the bearer token not the api key as a query, also are there any special headers that need to exist/not exist on the API call?
Reply by Travis Bell
on August 19, 2021 at 2:38 PM
I believe the issue is that you have a typo in your params, the params aren't
primary_release_date_gte
andprimary_release_date_lte
but ratherprimary_release_date.gte
andprimary_release_date.lte
.Reply by Omara8
on August 19, 2021 at 2:40 PM
yes i had just figured it out as well, again as i said earlier, very unintuitive