Using the API to add books

DiscussãoHacking LibraryThing

Aderi ao LibraryThing para poder publicar.

Using the API to add books

1Gwendydd
Dez 29, 2018, 2:59pm

I think what I want to do is impossible, but I want to be sure...

Is there a way to use the LibraryThing API to add a book to my catalog?

I'm trying to make a good way to keep LibraryThing and Goodreads in sync. I strongly prefer LibraryThing over Goodreads, but a lot of my friends are only on Goodreads, so I use both and it's annoying posting my reviews in both places. Ideally, I would like to be able to write a review on my WordPress blog, and then write a WordPress plugin that will automatically add the book to Goodreads and LibraryThing with APIs. However, as far as I can tell, LibraryThing's API will not let you add books to your catalog via the API. Is that correct?

Thanks!

2divinenanny
Dez 29, 2018, 3:42pm

Unfortunately yes. There is no API to add reviews (or books).

What I did was write a script in Selenium that takes the data from my own database (MySQL) and fill in fields in the Manual Add page automatically. The only things I do manually are collections, covers and "from where?". You could do something similar using the WordPress database as a source.

3Gwendydd
Dez 29, 2018, 5:29pm

Thanks for confirming that, divinenanny! At this point, I'm thinking I will write a Chrome extension, and every time you click "save" on a book page, the extension will add/update the book in Goodreads and WordPress. If I come up with something that works, I'll post it here!

4thcipriani
Jan 14, 2019, 9:59am

Blerg. I had the same question. It seems like it should be trivial functionality.

It's bizarre, there's an alexa skill that is capable of adding books to an account via ISBN( https://www.amazon.com/LibraryThing-com-LibraryThing/dp/B07B4L1L2H ). I made (the possibly incorrect) assumption that this was accomplished via the thingAuth api (play on "OAuth") that should authorize an application to make modifications as a user (I was guessing).

I filled https://www.librarything.com/topic/302374 hoping this was a documentation oversight (I'm still holding out hope).

Alternatively could someone fight their way through this using curl and saving cookies somewhere? Dunno.

5halloleo
Mar 3, 2020, 2:15am

>4 thcipriani: Does this thingAuth exist - or is it your play on "OAuth"?

7halloleo
Mar 3, 2020, 8:21pm

>6 divinenanny: Thanks a lot for the clarification. :-)

From what I can see on that page I can read profiles with this, right? Can I fetch user's book data with this as well?

8divinenanny
Mar 5, 2020, 3:08am

>7 halloleo:
Your app can read the profile and book data (I think) of the user that is logged in through thingAuth, not all users. That's how I read the docs.

9halloleo
Mar 19, 2020, 2:02am

>8 divinenanny: Cool! Thanks.

10m_z
Jun 25, 2020, 4:06pm

I am curious if this functionality has been added (or if it is even in the plans)?

I would like to set up (probably) a bash script to add books to my library directly from my command line, without having to use the browser at all. And also to pull from my database and display it in my terminal. Update books with ratings and reviews etc.

11divinenanny
Ago 31, 2020, 5:48am

It hasn't been added, I don't know about plans. The entire API is currently disabled because of work on LT2. I still hope that a modern API with adding books will be added sometime in the future.

Personally I use Selenium on headless Chrome to "manually" add books, maybe that is something that can help for now.