I am working on my implementation for adding / updating a review, but I'm running into a 400 Bad Request response. I'm willing to bet I'm doing something silly, but I've been staring at it for a while and just not getting anywhere.
My code for adding a book to a shelf is working fine after updating to the version of signpost that Casper recommended. If I attempt to call Review.Create on a book that I have already reviewed I get the expected 422 error. Here is sample code from my call to review.update
HttpClient httpClient = new DefaultHttpClient(); HttpPost post = new HttpPost("http://www.goodreads.com/review/" + reviewId + ".xml");
List parameters = new ArrayList(); parameters.add(new BasicNameValuePair("shelf", shelves.get(0))); parameters.add(new BasicNameValuePair("review[review]", review)); parameters.add(new BasicNameValuePair("review[read-at]", dateRead)); parameters.add(new BasicNameValuePair("review[rating]", Integer.toString(rating))); post.setEntity(new UrlEncodedFormEntity(parameters)); _Consumer.sign(post);
HttpResponse response = httpClient.execute(post);
Stepping through with the debugger I can see that all of the values for the parameters to the POST request are as expected, and shelf.get(0) evaluates to 'read'.
My code for adding a book to a shelf is working fine after updating to the version of signpost that Casper recommended. If I attempt to call Review.Create on a book that I have already reviewed I get the expected 422 error. Here is sample code from my call to review.update
HttpClient httpClient = new DefaultHttpClient();
HttpPost post = new HttpPost("http://www.goodreads.com/review/" + reviewId + ".xml");
Stepping through with the debugger I can see that all of the values for the parameters to the POST request are as expected, and shelf.get(0) evaluates to 'read'.