APIs

From MoochWiki

Jump to: navigation, search

A BookMooch Application Programming Interface (API) is an interface to allow programmers to develop custom applications for using BookMooch.com -- for example, programmers might create a web application to add books to their inventories only if there are no other copies available.

The average BookMoocher without an interest in custom programming will find little of use on this MoochWiki page.

Contents


BookMooch API Overview

All the API calls support XML output, by adding &o=xml on the GET url line.

Please limit your API calls to no more than 10 per second. If you serialize them, that should be fine -- just be careful if you have many threads/processes in your application calling the BookMooch APIs, that you aren't super busy at times.

To add a book to your inventory, wishlist or save for later, use the "userbook" api call.

If that call fails, it is because that ASIN (aka ISBN) is not in the BookMooch database. You can have BookMooch import the book data from an Amazon store with the "amazon_add" call, and then re-call "userbook"

To mooch a book, first call "moochable" to find out who is offering the book.

If you want to limit your mooching to people in your country, call "userid" for each of the people who are offering the book and look at "country" field to see that it is the same as your country. You may also want to be smart in your code, and for books that are offered by a lot of people, mooch from people who have the longest history of sending out books.

Use the "mooch" call to actually ask for the book to be sent to you. You have to specify the asin= giverid= address= paramters.

General APIs

asin

All information about a book (or list of books). Give it an asins= list of ASINs (or ISBNs) and it will return an XML document (documentation) of all the data for those asins. If the ASIN does not exist inside the BookMooch data, no data is returned for it in the XML document.

pending

All information about pending mooch transaction (or list of transactions). Pending transactions have the form of "userid/number" as in "johnbuckman/12". Give it an id= list of ASINs and it will return an XML document (documentation) of all the data for those transaction. If the id does not point to a current pending transaction, no data is returned for it in the XML document.

userid

All information about a given BookMooch user (or list of users). Give it an userids= list of user ids and it will return an XML document (documentation) of all the data for those users. If the userid does not point to a current BookMooch user, no data is returned for it in the XML document.

wishlist

ISBNs on a wishlist. Give it an asin= list of ASINs (or ISBNs) and it will return a carriage-return separated list of ASINs that are on wishlists at BookMooch. n=1 option returns number of people with that book on their wishlist. o=xml option returns simple XML output.

moochable

ISBNs available for mooching. Give it an asin= list of ASINs (or ISBNs) and it will return a carriage-return separated list of ASINs that are available for mooching (ie, on someone's inventory) at BookMooch. n=1 option returns number of people with that book in their inventory. o=xml option returns simple XML output.

userbook

Add given ISBNs to user's inventory/wishlist/savelater. Give it an asin= list of ASINs (or ISBNs) and it will return a carriage-return separated list of ASINs that were successfully added. o=xml option returns simple XML output. Requires http-auth name and password of user to add to. target= must be 'inventory' or 'wishlist' or 'savelater'. Change action= to 'del' to delete instead of adding.

GUI Entry Points

mooch_choice

Mooch (get) the given ASIN. The user will be prompted for a name/password if they are not currently logged in, and given a helpful screen if they don't have a login. You need to indicate only asin=.

add_select

http://bookmooch.com/m/add_select?asin=0072971231&store=amazon.com Add the given ASIN to a user's inventory (ie, books to be given away). The user will be prompted for a name/password if they are not currently logged in, and given a helpful screen if they don't have a login. You need to indicate both the asin= and store=amazon.com as the source of the info. Alternate amazon stores (amazon.fr, amazon.co.uk, etc...) are also acceptable.

wishlist_add

Add the given ASIN to a user's wishlist. The user will be prompted for a name/password if they are not currently logged in, and given a helpful screen if they don't have a login. You need to indicate both the asin= and store=amazon.com as the source of the info. Alternate amazon stores (amazon.fr, amazon.co.uk, etc...) are also acceptable.

savelater_add

Add the given ASIN to a user's save-for-later list. The user will be prompted for a name/password if they are not currently logged in, and given a helpful screen if they don't have a login. You need to indicate both the asin= and store=amazon.com as the source of the info. Alternate amazon stores (amazon.fr, amazon.co.uk, etc...) are also acceptable.

Personal tools