-
Notifications
You must be signed in to change notification settings - Fork 65
Append To Response
All of the methods with the API return a single part of the movie record. The concept behind this is that you (the caller) get back only the information that you require for any single call. Additionally it helps TheMovieDB manage their servers better as there are lots of smaller requests which has a lower overall impact on the database.
This function call allows you (the caller) to specify all the different parts of a movie, TV or person that you want in a single call and get a single object back for that call.
All the Info
calls have it, these are currently:
- getMovieInfo
- getMovieInfoImdb
- getTVInfo
- getSeasonInfo
- getEpisodeInfo
- getPersonInfo
AppendToResponse is always the last call in the function and can be called in a number of ways. For example, the movie info call looks like this:
public MovieInfo getMovieInfo(int movieId, String language, String... appendToResponse) throws MovieDbException
and can be called in the following ways:
getMovieInfo(78, "en")
getMovieInfo(78, "en", "images")
getMovieInfo(78, "en", MovieMethod.IMAGES.getPropertyString())
getMovieInfo(78, "en", "images", "credits")
getMovieInfo(78, "en", MovieMethod.IMAGES.getPropertyString(), MovieMethod.CREDITS.getPropertyString())
Using a string array
String[] atr = new String[]{"images", "credits"};
getMovieInfo(78, "en", atr)
Using the AppendToResponseBuilder (best)
String atr = new AppendToResponseBuilder(MovieMethod.CREDITS).add(MovieMethod.IMAGES).build();
getMovieInfo(78, "en", atr)
There are 5 enumerations provided with the API to help build the append to response methods. Each is specific to one of the 5/6 info methods mentioned above, these are (the names should be self explanatory)
- MovieMethod
- PeopleMethod
- TVMethod
- TVSeasonMethod
- TVEpisodeMethod
These methods can also be used with the hasMethod(method)
function of each of the Info objects to confirm that there is data about a specific AppendToResponse call.