This action allows you to update one or several documents.
| 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. |
| subscription_code | Use the API code supplied in the “Your subcriptions” page, or recovered by the getAccountSubscriptions API |
| documents |
Table with the documents to revise. Each document itself is a table which contains the following elements (the order is of no importance): Required:
|
This request returns an array with one line per published document, the key of which being an counter starting from 1. Each line is an array with the following information:
| Type | "Success" or "Error" |
| CID | ID of the uploaded file |
| Message | Texte confirming the success or explaining the error. |
| Book |
In case of failure, not present. In case of success, array with the following elements:
|
| ErrorCode | Error code. Empty if success. |
An error message is sent back in case of problems.
<!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>Publish documents</title>
</head>
<body>
<?php
include_once('nusoap.php');
include_once('nusoap_mime.php');
$client = new nusoap_client_mime('http://api.calameo.com/?wsdl', true);
$client->setHTTPEncoding('gzip, deflate');
$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.reviseBooks';
$cid1 = $client->addAttachment('', 'c:/my_first_document.pdf');
$doc1 = array(
'Code' => '03135743116735424',
'CID' => $cid1
);
$cid2 = $client->addAttachment('', 'c:/my_second_document.pdf');
$doc2 = array(
'Code' => '2134167313467431',
'CID' => $cid2
);
$params = array (
'api_key' => '123346544abdefbca1546854',
'login' => 'email@moncompte.com',
'md5_pwd' => 'd4f7ccab36fbfedc5f53e09d20d6973a',
'subscription_code' => '05511df55155d5a5bc5',
'documents' => array($doc1, $doc2),
);
$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>';
echo 'Books successfully updated!';
echo '</pre>';
}
}
?>
</body>
</html>