adamkrogh / goodreads-dotnet Goto Github PK
View Code? Open in Web Editor NEW:books: Goodreads .NET API Client Library
License: MIT License
:books: Goodreads .NET API Client Library
License: MIT License
Hello, I am a bit new to OAuth, but am struggling to understand how this library can be used to get access to an authenticated user's data.
The example includes these two lines:
// Create an authenticated API client
var authClient = new GoodreadsClient("apiKey", "apiSecret", "oauthToken", "oauthTokenSecret");
// Get a user's OAuth access token and secret after they have granted access
var credentials = client.Connection.Credentials.GetAccessToken(apiKey, apiSecret, requestToken, requestSecret);
I have my API Key & Secret... my confusion is related to the other 4 items : oauthToken, oauthTokenSecret, requestToken, requestSecret.
If I do the following:
// Create an unauthenticated API client [because right now I have no tokens, right?]
var client = new GoodreadsClient("apiKey", "apiSecret");
// Get the Goodreads URL to redirect to for authorization
var authorizeUrl = client.Connection.Credentials.GetRequestTokenAndBuildAuthorizeUrl(callbackUrl);
//Incidentally, if I also do this:
var requestToken=client.Connection.Credentials.GetRequestToken().OauthToken;
//requestToken is different from the value in the authorizeUrl... why is that?
Redirect user to authorizeUrl for "Allow" permission to be granted. Goodreads redirects back to the callBack url including a query string like: "?oauth_token=xxxxxxxxx&authorize=1"
What does "oauth_token" represent? Is this the "requestSecret"?
Example code from callback, which includes the query string data:
string requestSecret = oauth_token;
var client = new GoodreadsClient(apiKey, apiSecret);
var requestToken = client.Connection.Credentials.GetRequestToken().OauthToken;
//If I then use that as the "requestSecret" with the "requestToken" value (which didn't match the url) like this:
var credentials = client.Connection.Credentials.GetAccessToken(apiKey, apiSecret, requestToken, requestSecret);
//credentials.OauthToken is null AND credentials.OauthTokenSecret is null... so... something has gone wrong here.
// Create an authenticated API client [This won't work because of nulls]...
var authClient = new GoodreadsClient(apiKey, apiSecret, credentials.OauthToken, credentials.OauthTokenSecret);
I am missing something significant here... Can you point out where I am going wrong?
Thanks
So, I am doing a call to Client.Series.GetListByAuthorId(author.Id) but it seems to just hang. When stepping through the code, I see that the request is constructed correctly, and the response includes expected XML data from Goodreads:
RestSharpExtensions.ThrowIfException
...
// Try and find an error from the Goodreads response
string error = null;
try
{
var document = XDocument.Parse(response.Content); <-- response.Content has expected data
...
The code gets to the end of "ThrowInfException" and returns the response without any exceptions.
But when it should just pass back the response data, it seems to get stuck at the very end of "Connection.ExecuteRaw()", and by stuck I mean it never gets beyond it. I have let it continue to run for 3-5 minutes before stopping the running code.
I'm not well versed in asynchronous methods... otherwise I'd try to fix this myself. I'm just not sure why it doesn't complete when the response is there and ready to return...
Thanks
Hello
This is actually a question: Is there any implementation of "owned books" method?
It looks like that Goodreads doesn't validate books' publish date information as you can see in the below book, publish year is 20176.
https://www.goodreads.com/book/show/35222701-net-microservices
As we parse the publish date in "ElementAsMultiDateField" method, the 20176 can't be parsed to a valid .NET DateTime and an exception would be thrown.
AppVeyor CI is broken now.
We need to update a AppVeyor config file to support a new project infrastructure.
Seems that Goodreads endpoint is not working as describe in an official documentation.
Moreover I think method is not working at all.
There is not an ability to approve a recommendation in a web version. An user need to add a book to his shelf instead. Also I can't ignore a recommendation using the Goodreads API. Server returns the "Not found" response for all my requests.
I'm going to send a bug ticket to the Goodreads support.
Will wait any feedback.
I was using the library for one of my projects and encountered this error out of nowhere. All I was doing, calling the client.Books.GetByBookId() method. I've already checked the parameter (BookID=929) and it's a valid one for sure. Furthermore, I've also encountered the same error while using client.Books.GetByTitle() method.
It would be great if you could have a look at the issue.
Any reason for not supporting the average_rating property in the XML when doing a book search?
@adamkrogh, you notes that "Destroy review" endpoint returns strange errors and never works.
I have investigated this and could say that the Goodreads API documentation is wrong.
The strange error said that server can't parse book identifier in request. It's really strange because I do not need to send any book id. I have looked at the web version and found that we need to send a book id instead of a reviewId. I try to do it. Unfortunately, now I'am getting Unathorized error. Moreover I've played with different combinations of parameters, values and request method. Nothing works! It's a sad.
Do you get any feedback from the Goodreads support?
Seems I have found a bug in Goodreads API again.
The "Update an owned book" always return 404 'Not found' result even if send the correct OwnedBookID.
So I think I collect all known issues together then I create an a issue ticket in Goodreads forum.
However I don't hope that we received any response. It looks like the Goodreads dev team didn't support the public Api anymore.
The Search function can just search based on given 'id' , 'title' and 'all'. But in order to search based on genre ,
The Code:
[QueryParameterValue("genre")]
Genre
must be added to Goodreads/Models/Request/BookSearchField.cs
I tried it and it works perfectly fine
I was following Goodreads.Demo but I have slightly modified it to adapt on a MVC web app.
On callback I receive oauth_token (its not empty, so I assume it is valid) and authorize == 1 but at the next step when I call client.GetAccessToken, the OAuthAccessToken is empty. Token and Secret are null.
I am running the sample on my local machine.
Due my latest changes we need to fill in README.md file.
Should update OAuth examples (need to use a new Auth methods)
Add more examples for another endpoints.
Dear @adamkrogh
Seems that you don't have time for further development. Unfortunatelly many API methods is not covered yet. The last commit was about one year ago.
I think your project is a very interesting. I'm considering some .net goodreads SDKs and assume that your project is the best. I'm going to implement some missing API methods and migrate library to .NET Core or .NET Standard.
What do you think about some pull requests from me? Could I ask you to add me as a project collaborator. It will facilitate my work.
Thanks in advance.
Regards
There is a place where we collect all available information about bugs in the Goodreads API.
Unfortunately, some bugs still exist and we don't know when they will be fixed.
If somebody has any ideas how to fix it or create workarounds, feel free to share it with us.
Known bugs below:
I registered to goodreads api but there is no link for https://www.goodreads.com/api/keys, how can I create an API Key ?
Once RestSharp supports .NET Standard, I think this library should be updated to do so aswell.
Issue about the topic on RestSharp: restsharp/RestSharp#992
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.