Goodreads Developers discussion

75 views
bugs > Authorized POST Requests error

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

message 1: by Ahmed (last edited Dec 25, 2014 01:20AM) (new)

Ahmed Alsuwaidi | 14 comments Hi, I am currently developing a goodreads client using the Qt framework.

I have authenticated the user using OAuth and I am able of performing authorized GET requests successfully with no problems. However, when I try to perform an authorized POST request I always get this:

"Not found" with an "error" tag around it

For example when trying to add a book to a shelf, this is the base string for the request:

"POST&https%3A%2F%2Fwww.goodreads.com%2Fshelf%2Fadd_to_sh..."

I also get the same response when trying to become a fan of an author, and post a status as well.

Any ideas ?

Thanks


message 2: by Ettore (new)

Ettore Pasquini Hey Ahmed, if I can read your POST request well, it seems like you're missing the "?" in your URL. You have /shelf/add_to_shelf.xml&book_id=123&name=read etc, which is incorrect since URL parameters should start with a "?", so:

/shelf/add_to_shelf.xml?book_id=123&name=read

Also, since this is a POST request the params should likely be sent as part of the body, not in the URL.


message 3: by Ahmed (new)

Ahmed Alsuwaidi | 14 comments Ettore wrote: "Hey Ahmed, if I can read your POST request well, it seems like you're missing the "?" in your URL. You have /shelf/add_to_shelf.xml&book_id=123&name=read etc, which is incorrect since URL parameter..."

Hi, thanks for the reply.

I was working on some little changes and the situation now is that the request works on the 2nd attempt.

I try to add to shelf or post a status, the first time it gives me the Not found error above, but then if I try it the 2nd time (without closing the app) it works fine.

What could the issue be with that? The parameters are all the same for both the requests, only things that differ obviously are the Timestamp and the nonce.


message 4: by Jeff (new)

Jeff (jeffwong) | 75 comments Mod
Does it always work on every 2nd POST (i.e. every other POST) or does it fail on the first post and succeed after the 2nd POST?


message 5: by Ahmed (new)

Ahmed Alsuwaidi | 14 comments It works every 2nd POST.

It always alternates, (fails, succeeds, fails, succeeds, etc.) and it always fails first.

Also it continues this pattern across different POST requests. For example, when I try to add a shelf it returns the error tag I posted before, then if I go to post a status on a book, it works on the first try because I already got the error when adding a shelf.


message 6: by Ettore (new)

Ettore Pasquini I'm a little lost on what's going on here exactly. Can you please post the entirety of your request i.e. including the oauth headers? *Obviously black out any sensitive info!*


message 7: by Ahmed (new)

Ahmed Alsuwaidi | 14 comments Alright, this is a POST request to add the third dark tower book to the to-read shelf.

The first POST request (Always fails) has these headers
* "book_id" : "34084"
* "name" : "to-read"
* "oauth_consumer_key" : "XXXXXX"
* "oauth_nonce" : "6427"
* "oauth_signature_method" : "HMAC-SHA1"
* "oauth_timestamp" : "1422210309"
* "oauth_token" : "XXXXXXX"
* "oauth_version" : "1.0"

For this POST I get this response:
"Not found"

Now when I attempt to send the POST request again (This one always succeeds), it has these headers:

* "book_id" : "34084"
* "name" : "to-read"
* "oauth_consumer_key" : "XXXXXXXXX"
* "oauth_nonce" : "14219"
* "oauth_signature_method" : "HMAC-SHA1"
* "oauth_timestamp" : "1422210311"
* "oauth_token" : "XXXXXXX"
* "oauth_version" : "1.0"

This one succeeds and the book gets added to my shelf.

This is the same with all other POST requests, the first one fails and I get a not found error, and the next one always works fine


message 8: by Daniel (new)

Daniel (dbmrq) | 19 comments Ahmed, did you ever figure this out?
I'm running into the same problem:
https://www.goodreads.com/topic/show/...

Ettore, any chance you could help?


message 9: by Vincent (new)

Vincent (patothon) | 1 comments Same here.

When trying to create a shelf (post to https://www.goodreads.com/user_shelve...), I get a 404.


message 10: by Feiyu (new)

Feiyu Yin (sanchishui) | 11 comments Hi Vincent and Daniel,

Could you please provide a list of all the POST requests that you are having problem with (https://www.goodreads.com/api/index#u... seems one of them), so that we can investigate?

Thanks!


message 11: by Daniel (new)

Daniel (dbmrq) | 19 comments Feiyu, I have this problem when posting a user status, as I described here: https://www.goodreads.com/topic/show/...


back to top