Goodreads Developers discussion
questions
>
Add Book
date
newest »
newest »
Karsten, are you doing POST to shelf/add_to_shelf and is it signed the same way you sign when doing updates/friends?
Karsten, I think this is related to the problem you're having with not being authorized to use auth_user. We're looking into it.
I have switched to another OAuth lib which has solved the issues I've had getting the user id. When trying to add a book I now get 404: Not found and not NotAuthorized. Somewhat strange as I call shelf/add_to_shelf.xml with id of book (which I have got from a previous search) and name of shelf e.g. "to-read".
Hi,I set up the resource and the parameters in one method
const string resource = "shelf/add_to_shelf.xml";
var parms = new List
{
new Parms("book_id", Book.Id.ToString(CultureInfo.InvariantCulture)),
new Parms("name", Shelf)
};
goodClient.AddBook(resource, parms, ParseAddBook);
I then call my client.
public void AddBook(string resource, IEnumerable parms, Action action)
{
var pc = new ParameterCollection();
foreach (var p in parms)
{
pc.Add(new Parameter(p.Key, p.Value));
}
var client = new OAuthClient(key, secret, token.AccessToken)
{
MethodType = MethodType.Post,
Url = string.Format("{0}{1}", baseUrl, resource),
Parameters = { pc }
};
client.GetResponseText() // post and GetResponse
.Select(s => XElement.Parse(s))
.ObserveOnDispatcher()
.Subscribe(
x => action(HttpStatusCode.OK, x.ToString()),
ex => MessageBox.Show(ex.ToString()));
}
I don't see major problems on this code. I tried the API endpoint on my side. Our oauth testing code passes explicitly the format parameter in the POST:data = {'format'=>'xml',
'book_id' => "#{b.id}",
'name' => "#{shelf.name}"}
post_oauth 'add_to_shelf', data
Can you try that?


I add two parameters: name of shelf and (Goodreads) Id of book. I know I'm authorized as I can do an updates/friends.xml. However, I get the response NotAuthorized.
Suggestions?