Goodreads Developers discussion

345 views
bugs > Quotes API not working?

Comments Showing 1-20 of 20 (20 new)    post a comment »
dateUp arrow    newest »

message 1: by Matt (last edited Mar 12, 2015 08:04PM) (new)

Matt (mattcurtis) | 18 comments I've been successfully using all other APIs (add books to shelves, search requests, progress updates) without issue. I've been trying to use the quotes API to create new ones, but my requests seemingly don't do anything (and the response returns an HTML login page)

URL:
http://www.goodreads.com/quotes.xml

POST Request Parameters:

{
"quote[author_id]" = 7168230;
"quote[author_name]" = "V.E. Schwab"; // Providing this makes no difference
"quote[body]" = "class compartment on a train, or been smuggled in by spies. If Sydney questioned the story, Serena would simply insist that her";
"quote[book_id]" = 13638125;
}


The request fails always if I add "quotes[tags]". I have not tried adding "isbn" (which I don't have) yet.

Additionally, is it possible to log a user into Goodreads if they wish to do so? So that I can redirect them to a logged-in Goodreads (probably not, but just curious).

EDIT:

Also (and this is probably the job of moderators) I accidentally made this quote using the online manual form. https://www.goodreads.com/quotes/6666... If someone could remove it that would be great...


message 2: by [deleted user] (new)

Hey Matt,

Just to double check, are you using OAuth when hitting the quotes api endpoint? You'll need to pass in an OAuth token for that request to work. See the docs at: https://www.goodreads.com/api/index#q...

If you're getting an HTML login page, I suspect it's because the request isn't properly signed with OAuth.

Using OAuth on endpoints that require it won't exactly log in the user, per se, but will allow you to make requests on behalf of the given user.


message 3: by Matt (last edited Mar 13, 2015 04:36AM) (new)

Matt (mattcurtis) | 18 comments Nichole wrote: "Hey Matt,

Just to double check, are you using OAuth when hitting the quotes api endpoint? You'll need to pass in an OAuth token for that request to work. See the docs at: https://www.goodreads.com..."


Hello Nicole,

Thanks for the reply! Yes, I'm using OAuth to make these requests. All of the other API endpoints that require user-authorization (status update, book shelving, etc.) work fine. This one doesn't.

Oh, also: a way to get the quote's URL after it has been posted would be great. Although wouldn't that be hitting the API more than once a second?


message 4: by Matt (last edited Mar 13, 2015 11:29AM) (new)

Matt (mattcurtis) | 18 comments Exact Headers:

{
"Accept-Language" = "en;q=1, fr;q=0.9, de;q=0.8, zh-Hans;q=0.7, zh-Hant;q=0.6, ja;q=0.5";
Authorization = "OAuth oauth_consumer_key=\"xxx\", oauth_nonce=\"xxx\", oauth_signature=\"xxx\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1426246758\", oauth_token=\"xxx\", oauth_version=\"1.0\"";
"Content-Type" = "application/x-www-form-urlencoded";
"User-Agent" = "Otus/1.0 (iPhone; iOS 7.1.2; Scale/2.00)";
}


Body Parameters (Query String)
quote[author_id]=7168230&quote[body]=been found in the first-class compartment on a train, or been smuggled in by spies. If Sydney questioned the story, Serena would simply insist that her sister&quote[book_id]=13638125


Sensitive data replaced with "xxx".


message 5: by Matt (new)

Matt (mattcurtis) | 18 comments Nichole wrote: "Hey Matt,

Just to double check, are you using OAuth when hitting the quotes api endpoint? You'll need to pass in an OAuth token for that request to work. See the docs at: https://www.goodreads.com..."


Hi Nichole - any updates?


message 6: by [deleted user] (new)

Hey Matt,

Sorry for the delay. I looked into this more and it appears we have a bug on our side.

When you create quotes through our website, we often require a captcha to reduce the amount of spam in our quotes section. In some cases, we are mistakenly requiring this captcha for api requests as well. We'll try to get in a fix soon.


message 7: by Matt (new)

Matt (mattcurtis) | 18 comments That's what I guessed the bug was. Thanks for the reply, I look forward to the fix.


message 8: by Matt (last edited Mar 28, 2015 09:49AM) (new)

Matt (mattcurtis) | 18 comments Nichole wrote: "Hey Matt,

Sorry for the delay. I looked into this more and it appears we have a bug on our side.

When you create quotes through our website, we often require a captcha to reduce the amount of spa..."


Hi Nichole - has there been any progress on this? This is one of the last features in my app.


message 9: by Ettore (new)

Ettore Pasquini Hey Matt, sorry, no progress yet. For future reference, ticket number is IOS-2884.


message 10: by Nichole (new)

Nichole Treadway Hey Matt,

We released a fix for this...can you try again?


message 11: by Matt (last edited Apr 08, 2015 10:19PM) (new)

Matt (mattcurtis) | 18 comments Nichole wrote: "Hey Matt,

We released a fix for this...can you try again?"


Hello Nichole,

Looks like it's working now! One thing I've noticed:

If quote[author_id] is provided and quote[author_name] isn't (I've tried an empty string and not providing the parameter at all), the request fails. However the API documentation states that if author_id is provided and author_name isn't, author_id will be used in its place.

Thanks for the work on this guys.


message 12: by Matt (new)

Matt (mattcurtis) | 18 comments Hey guys,

Did you see my last comment?


message 13: by Ettore (new)

Ettore Pasquini hey Matt, I just checked the docs and they say that author_name IS required (no matter what). It's author_id that's NOT required.

https://www.goodreads.com/api/index#q...

So while the api seems to be working as advertised, I agree with you that if author_id is specified it should trump the author name in an ideal world. Perhaps this was coded this way to avoid users just passing in a random author_id.


message 14: by Matt (new)

Matt (mattcurtis) | 18 comments Hello and thanks for the reply, Ettore.

That makes sense. However if I recall, in my tests author_id doesn't seem to be used at all. This makes difficult posting a quote for a specific author/book. I'll try things out again to be sure, but I don't think that it's being used.


message 15: by Matt (new)

Matt (mattcurtis) | 18 comments Confirmed. I ran some tests again and author_id is not used at all. I provided author_name and author_id to all requests. Instead of using the provided author_id it creates a new author in the database, and returns that id in the response body.


message 16: by Matt (new)

Matt (mattcurtis) | 18 comments Hey guys, and updates on this?


message 17: by Nichole (new)

Nichole Treadway Hey Matt,

What author id and author name are you using ?

For some reason, if author_name doesn't match exactly what we have for the author with that id's name, the quote api will ignore author_id and create a new author record instead.

For example, if I create a quote for Erik Larson and pass in author_id = 5869 and author_name = "Eric Larson" (which is misspelled), it's ignoring author_id and creating a new record for a new author Eric Larson.

Is that possibly what's going on in your case?

Obviously this is not good and needs to be fixed, but could be a quick workaround to your issues ...to just verify that the name you're passing in matches what Goodreads has for that author.


message 18: by Matt (last edited May 06, 2015 05:33PM) (new)

Matt (mattcurtis) | 18 comments Nichole wrote: "Hey Matt,

What author id and author name are you using ?

For some reason, if author_name doesn't match exactly what we have for the author with that id's name, the quote api will ignore author_i..."


Hello Nichole, thanks for getting back to me.

I wanted to avoid caching the author name as what's in Goodreads database might change, and the metadata (relative to my user's library) of the particular book I'm posting a quote for might not match what's in your database... An id lasts (hopefully), the name might not.

For now I think I can use the /author/show API endpoint to retrieve exact author name, but that'll cause me to be hitting up Goodreads with two requests for what I should be able to do with one (which makes my app seem somewhat slower and affects your bandwidth).

That said, thank you for your research into this problem Nichole. I really appreciate it.

Looking forward to any updates! :)


message 19: by Sty (last edited May 17, 2016 11:53AM) (new)

Sty Doevsky (thzvm) | 1 comments Hey guys, what happened?
Or it's my mistake? :(


resp = session.get(url='https://www.goodreads.com/api/auth_user')
print(resp.status_code)
print(resp.content)

quote, quote_url = {
'author_name': 'Albert Camus',
'author_id': 957894,
'book_id': 770754,
'body': 'But what does it mean, the plague? Its life, thats all.',
'isbn': 2070360423}, 'https://www.goodreads.com/quotes?form...'

resp = session.post(url=quote_url, data=quote)
print(resp.status_code)
print(resp.content)

session.close()


>> 200
>> b'<?xml version="1.0" encoding="UTF-8"?>\n . . . '

>>404
>> Not found

or

>> 406
>> Not Acceptable



message 20: by Charles (new)

Charles Kim | 28 comments See if https://www.goodreads.com/quotes/new?... works instead

Charles


back to top