* @param rating
* @return
* @throws MovieDbException
*/
public boolean postMovieRating(String sessionId, Integer movieId, Integer rating) throws MovieDbException {
ApiUrl apiUrl = new ApiUrl(apiKey, BASE_MOVIE, movieId + "/rating");
apiUrl.addArgument(PARAM_SESSION, sessionId);
if (rating < 0 || rating > RATING_MAX) {
throw new MovieDbException(MovieDbExceptionType.UNKNOWN_CAUSE, "Rating out of range", apiUrl.buildUrl());
}
String jsonBody = convertToJson(Collections.singletonMap("value", rating));
LOG.info("Body: {}", jsonBody);
URL url = apiUrl.buildUrl();
String webpage = requestWebPage(url, jsonBody);
try {
StatusCode status = mapper.readValue(webpage, StatusCode.class);
LOG.info("Status: {}", status);