Goodreads Developers discussion
questions
>
Add Book
date
newest »





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()));
}

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?