Learn how to access the list of library books in your account and view the contents and properties of each with the help of the Library API.
Please make sure you read the Kotobee API Introduction before starting out here.
List libraries
The URL base API (https://www.kotobee.com/api/v1/library/all) fetches the list of libraries in your account. Available variables are as follows,
serial or accesskey | Contains your authentication method |
Here's an example of a list of libraries for a user account: https://www.kotobee.com/api/v1/library/all?serial=1234-5678-9999-9999
An example of how to do it using POST variables with PHP:
$curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => "https://www.kotobee.com/api/v1/library/all", CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POST => true )); $data = array(); $data["serial"] = "1234-5678-9999-9999"; curl_setopt($curl, CURLOPT_POSTFIELDS, $data); $resp = curl_exec($curl); //echo $resp; //in case you want to view the result curl_close($curl);
Get library
The URL base API (https://www.kotobee.com/api/v1/library/get ) fetches all books and properties of a library using its ID. The response includes the list of categories in the library. Available variables are as follows,
serial or accesskey | Contains your authentication method |
id | The library ID |
simple | If set to 1, simplified details will be fetched |
Here's an example on how to get simplified details of a library of ID 42: https://www.kotobee.com/api/v1/library/get?serial=1234-5678-9999-9999&id=42&simple=1
An example of how to do it using POST variables with PHP:
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => "https://www.kotobee.com/api/v1/book/all",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POST => true
));
$data = array();
$data["serial"] = "1234-5678-9999-9999";
$data["id"] = "42";
$data["simple"] = "1";
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
$resp = curl_exec($curl);
//echo $resp; //in case you want to view the result
curl_close($curl);
Add category
The URL base API (https://www.kotobee.com/api/v1/library/addcat) adds a category to your library. Passing the id of an already existing category allows you to edit its properties. Available variables are as follows,
serial or accesskey | Contains your authentication method |
libid | The library ID |
name | The category name |
id | In case you are editing an existing category, include the category ID here |
parent | The ID of the parent category, in case the category will be added as a child of another one |
submode | Shows different view and click behaviors in the category list. Available options: visible: The category along with its children (nested) categories are shown at the same time. Clicking a parent category will list the books for that category (see listmode variable below). expand: If the category is a parent category, clicking the category will expand the children categories below it separate: If the category is a parent category, clicking the category will replace the currently listed categories with the category's children |
listmode | Specifies which books are listed once a parent category is clicked. Available options are: parent: Display list of books that belong to the parent category all: Display list of books that belong to the parent category in addition to any of the children categories |
css | You may customize the category appearance (in the categories list) using passed CSS styles |
tab | Whether the category is enable to appear in the header menu |
section | Whether the category is used as a section in the main book listing, similar to how Netflix displays movies |
hide | Hide the category from the categories list |
force | Override a returned error, in case you are adding a category name that already exists |
Here's a simple example of adding a new category using its name only account: https://www.kotobee.com/api/v1/library/addcat?serial=1234-5678-9999-9999&libid=42&name=Fiction
An example of how to do it using POST variables with PHP:
$curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => "https://www.kotobee.com/api/v1/library/addcat", CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POST => true )); $data = array(); $data["serial"] = "1234-5678-9999-9999"; $data["libid"] = "42"; $data["name"] = "Fiction"; curl_setopt($curl, CURLOPT_POSTFIELDS, $data); $resp = curl_exec($curl); //echo $resp; //in case you want to view the result curl_close($curl);