API.updateBooks
Questa azione ti consente di aggiornare uno o più documenti.
Richiesta
| api_key | Utilizza la tua chiave API | ||||
| login | Utilizza l'indirizzo e-mail di un profilo account che ha accesso alle API. | ||||
| md5_pwd | Utilizza la password dal profilo, crittografata in formato MD5. | ||||
| subscription_code | Utilizza il codice API fornito nella pagina “I tuoi abbonamenti” o recuperato dall'API getAccountSubscriptions | ||||
| documents |
Tabella con i documenti da pubblicare. Ogni documento è una tabella contenente i seguenti elementi (l'ordine non è rilevante): Obbligatorio:
Opzionale: (I valori predefiniti sono sottolineati):
|
Risposta
Questa richiesta restituisce una matrice con una riga per ogni ogni documento pubblicato, la cui chiave è un contatore che parte da 1. Ogni riga è una matrice con le seguenti informazioni:
| Type | "Riuscito" or "Errore" |
| CID | ID del file caricato |
| Message | Testo che conferma il buon esito o che spiega l'errore. |
| Book |
In caso di errore, non è presente. In caso di successo, si avrà una matrice con i seguenti elementi:
|
| ErrorCode | Codice di errore. Vuoto se l'operazione è riuscita. |
In caso di problemi verrà restituito un messaggio di errore.
Esempio
<!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.updateBooks';
$cid1 = $client->addAttachment('', 'c:/my_first_document.pdf');
$doc1 = array(
'Code' => '03135743116735424',
'CID' => $cid1,
'Name' => 'My first document',
'Description' => 'This is the first document',
'Date' => '2007-12-24',
'IsPublished' => true,
'PublishingMode'=> 2,
'AdultMode' => 1
);
// No revised file for this document
$doc2 = array(
'Code' => '2134167313467431',
'Name' => 'My second document',
'Description' => 'This is the second document',
'Date' => '2004-12-24',
'IsPublished' => false,
'PublishingMode'=> 1
);
$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>
Loading...