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 accesskeyContains 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);

Postman example

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 accesskeyContains your authentication method
idThe library ID
simpleIf 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);

Postman example

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 accesskeyContains your authentication method
libidThe library ID
nameThe category name
idIn case you are editing an existing category, include the category ID here
parentThe ID of the parent category, in case the category will be added as a child of another one
submodeShows 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
listmodeSpecifies 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
cssYou may customize the category appearance (in the categories list) using passed CSS styles
tabWhether the category is enable to appear in the header menu
sectionWhether the category is used as a section in the main book listing, similar to how Netflix displays movies
hideHide the category from the categories list
forceOverride 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);

Postman example