Postman exampleLearn how to access the list of books in your account with the Book API.
Please make sure you read the Kotobee API Introduction before starting out here.
List books
The URL base API (https://www.kotobee.com/api/v1/book/all) fetches the list of cloud ebooks, hosted ebooks, or library ebooks in your account. Available variables are as follows,
serial or accesskey | Contains your authentication method |
type | Whether fetch the list of cloud ebooks, hosted ebook, or library ebooks. The value may be 'cloud', 'hosted', or 'library', respectively. The default is 'cloud' |
libid | The library ID in the case that you're listing books of a library |
simple | If set to 1, only the following details will be fetched for each book: ID, name, and either public (for cloud ebooks) or alias (for hosted ebooks) |
catid | Filter by category ID (multiple categories may be used, separated by commas) |
Here's an example on a list of ebooks in a library with ID 123 for a user account: https://www.kotobee.com/api/v1/book/all?serial=1234-5678-9999-9999&type=library&libid=123
Here's an example on a list of cloud ebooks (with full details) for a user account: https://www.kotobee.com/api/v1/book/all?serial=1234-5678-9999-9999&type=cloud
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["type"] = "cloud";
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
$resp = curl_exec($curl);
//echo $resp; //in case you want to view the result
curl_close($curl);
Add book
The URL base API (https://www.kotobee.com/api/v1/book/add) adds a new book (hosted ebook or library ebook) to your account. This endpoint accepts an EPUB file as a base64 encoded string. You may convert your file to a base64 string using any base64 encoding service such as https://www.base64encode.org/. Full list of variables are as follows,
serial or accesskey | Contains your authentication method |
libid | The library ID in the case that you're adding a book to a library |
name | The book title |
author | The book author's name |
publisher | The book publisher's name |
rights | The book rights |
lang | The book language |
description | The book description |
cover | The internal path to the cover image of the book (e.g. EPUB/imgs/cover.jpg) |
epub | Base64 encoded string of the EPUB file to be uploaded |
size | The size of the EPUB file in bytes (used for verification purposes) |
If successful, the response will return the book object along with its new ID.
Edit book
The URL base API (https://www.kotobee.com/api/v1/book/edit) edits the book info (hosted ebook or library ebook) in your account. This endpoint requires the book id which you want to edit. Full list of variables are as follows,
serial or accesskey | Contains your authentication method |
id | The ID of the book you want to edit |
name | The book new title |
author | The book new author's name |
publisher | The book new publisher's name |
rights | The book new rights |
lang | The book new language |
description | The book new description |
cover | The internal path to the new cover image of the book (e.g. EPUB/imgs/cover.jpg) |
isbn | The book new isbn |
If successful, the response will return the book object.
Get book
The URL base API (https://www.kotobee.com/api/v1/book/get) gets a book's details from your account using its ID. Full list of variables are as follows,
serial or accesskey | Contains your authentication method |
id | The book ID |
Delete book
The URL base API (https://www.kotobee.com/api/v1/book/delete) deletes a book from your account. Full list of variables are as follows,
serial or accesskey | Contains your authentication method |
id | The book ID |
type | The book type: hosted, cloud, or lib, to represent hosted ebook, cloud ebook, or library ebook respectively |