Goodreads Developers discussion

HTTP/1.1 400 Bad Request on Update / Create Review

Comments Showing 1-3 of 3 (3 new)    post a comment »
dateDown arrow    newest »

message 1: by Adam (new)

Adam (jademason) | 66 comments 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("" + 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));

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'.

message 2: by Adam (new)

Adam (jademason) | 66 comments Found it, used a hyphen rather than an underscore on the read_at parameter. D'oh!

message 3: by Michael (new)

Michael Economy (michaeleconomy) glad to help :)

back to top