Goodreads Developers discussion
questions
>
Using review/destroy to delete a review of a book
date
newest »
newest »
Oleg, thanks for that link. That seems like it’s the web URL that uses cookie-based authentication, or am I misunderstanding? That seems useful if you’re doing a one-off job, but getting users’ login cookies isn’t possible for a client library.
No, this is api url, which you should use with oauth authentication for doing such type of requests. You should make in your library possibility to getting access for user and use credentials from user for your requests
Hmm, doesn't seem to work for me. With that format I get an HTTP 401 Unauthorized and I'm sure the user OAuth credentials are correct. Do you know of an existing library which makes this request successfully? Maybe I can look at how it implements review deletion.Request showing that user OAuth credentials are configured correctly. I can edit an existing review for this user:
>> OAUTH_GOODREADS_CLIENT.oauth_request_method(:post, "/review/#{review_id}.xml", {:"review[read_at]" => '2017-06-01'})
I, [2018-06-12T20:47:28.525579 #6140] INFO -- : POST /review/2417021488.xml
I, [2018-06-12T20:47:29.857878 #6140] INFO -- : PARAMS {"review[read_at]"=>["2017-06-01"]}
I, [2018-06-12T20:47:29.857916 #6140] INFO -- : BODY: Net::HTTPOK
<?xml version="1.0" encoding="UTF-8"?>
<review>
<id type="integer">2417021488</id>
<user-id type="integer">82720595</user-id>
<book-id type="integer">234225</book-id>
<read-at type="datetime">2017-06-01T07:00:00+00:00</read-at>
...
</review>
Request to /review/destroy/:book_id?id=:review_id&format=xml fails Unauthorized:
>> OAUTH_GOODREADS_CLIENT.oauth_request_method(:post, "/review/destroy/#{book_id}", {id: review_id, format: 'xml'})
I, [2018-06-12T20:45:17.924128 #6140] INFO -- : POST /review/destroy/234225
I, [2018-06-12T20:45:18.294053 #6140] INFO -- : PARAMS {"format"=>["xml"], "id"=>["2417021488"]}
I, [2018-06-12T20:45:18.294090 #6140] INFO -- : BODY: Net::HTTPUnauthorized
<?xml version="1.0" encoding="UTF-8"?>
<errors>
<error>Unauthorized</error>
</errors>
First of all: send DELETE instead of POST like in docs.Params should be send in url, I think, like in GET request.
The docs say a lot of things but it seems like they're out-of-sync with the actual implementation (you can see above that I use POST to successfully edit a review even though the docs recommend PUT; in fact, the endpoint errors if you use HTTP PUT).I've played around with this request a bunch of ways and basically can't get it to work no matter what combination of params I try. If you or anyone else has a working OAuth request, I'll use that to figure out what's wrong. My current thinking is that this endpoint doesn't work.
It looks like this has been an issue for other folks as well (https://www.goodreads.com/topic/show/...).





The review in question is 2417021488 (at https://www.goodreads.com/review/show...)
I have tried every variation I can think of based on the documentation for review.destroy https://www.goodreads.com/api/index#r...
The docs say the URL is /review/destroy/12345?format=xml (with an ID in the URL, as well as an id parameter). My assumption is that this is the review id, but I'm not sure whether I should supply no id param, the same value as an id, or something else. Everything I try results in an error, either Unauthorized or NotFound with an error message about a book id.
Here is a transcript of my requests:
# Here I make an authenticated OAuth query so you can see my client is properly configured
Then I get the current user's review for a book:
Then I try to delete the review, putting the review id in the URL, as a parameter, both, with the book_id:
Any suggestions on how to use the /review/destroy API?