API.fetchBookTocs
This action allows you to recover the table of contents of a publication using its unique key.
Request
| api_key | Use your API key |
| login | Use the e-mail address of an account profile that has access to the APIs. |
| md5_pwd | Use the password from the profile, encrypted in MD5 format. |
| book_code | Unique identifying key for the publication, supplied in the «Your publications » page |
|
order (optional)
|
String of characters used to define the organization criteria for the entries of the table of contents. The possible values are:
|
|
way (optional) |
String of characters used to define the sort order. The possible values are:
|
| start (optional) | Start position of the range of entries sent. |
| step (optional) | Number of entries to be sent from the start position. |
Response
This request sends a table with the following information:
| Name | Wording of the table of contents entry |
| Level | Level of the entry, from 1 for the highest. |
| PageNumber | Number of the referenced page. |
An error message is sent back in case of problems.
Example
This example shows how to recover the first 10 entries of a publication’s table of contents:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The table of contents of my publication</title>
</head>
<body>
<?php
include_once('nusoap.php');
$client = new soapclient('http://api.calameo.com/?wsdl', true);
$err = $client->getError();
if ($err) {
// Display the errors
echo 'SOAP Error: ' . $err;
// If an error occurs, it\’s useless to continue
die('An error has occurred!');
}
$message = 'API.fetchBookTocs';
$params = array (
'api_key' => '05511df55155d5a5bc5',
'login' => 'email@myaccount.com',
'md5_pwd' => 'd4f7ccab36fbfedc5f53e09d20d6973a',
'book_code' => '05511df551231321'
'order' => 'Order',
'way' => 'UP',
'start' => 0,
'step' => 10
);
$result = $client->call($message, $params);
$result = $client->call($message, $params);
if ($client->fault) {
// An error has occurred
die('An error has occurred!');
} else {
// Verify if a SOAP error wasn’t sent back
$err = $client->getError();
if ($err) {
// Display the error
echo 'SOAP Error: ' . $err ;
} else {
// All went well, you can process the result => $result
echo '<pre>';
print_r($result);
echo '</pre>';
}
}
?>
</body>
</html>
Loading...