English Français Español
ex. : internet calameo download

API.publish

This action allows you to publish one or several documents.

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.
subscription_code Use the API code supplied in the “Your subcriptions” page, or recovered by the getAccountSubscriptions API
documents

Table with the documents to publish.

Each document itself is a table which contains the following elements (the order is of no importance):

Required:

  • CID : ID of the uploaded file. See code example below.

Optional: (Default values are underlined) :

  • CategoryReference : Category of the publication
     
    • MISC
    • NEWS
    • ARTS
    • AUTO
    • BUSINESS
    • MOVIES
    • CULTURE
    • SCHOOL
    • TRAVEL
    • HUMOR
    • VIDEOGAMES
    • LAW
    • LITERATURE
    • MUSIC
    • NATURE
    • POLITICS
    • RELIGION
    • HEALTH
    • SCIENCES
    • SEXY
    • PEOPLE
    • SPORTS
    • TECH

 

  • FormatReference : Format of the publication:
     
    • MISC
    • ALBUMS
    • BD
    • BROCHURES
    • CATALOGS
    • COMICS
    • NEWSPAPERS
    • BOOKS
    • MAGAZINES
    • MANGAS
    • MANUALS
    • MULTIMEDIA
    • SHEETMUSIC
    • PRESENTATIONS
    • REPORTS
    • NOVELS

 

  • DialectReference : Publication language 2-letters ISO- 639-1 code, or UNKNOWN
  • Name : Publication title (if empty, filename will be used)
  • Description : Publication description
  • Date : Publication Date
  • IsPublished : Activation status (true or false)
  • PublishingMode : Access mode (public: 1, private: 2)
  • PrivateUrlMode : Create a private URL (yes: 1 ; no: 0)
  • SubscribingMode : Allow subscribers' access (yes: 1 ; no: 0)
  • CommentingMode : Comments behaviour (None: 0, moderate all: 1, modérer except contacts: 2, accept only from contacts: 3, accept all: 4)
  • DownloadingMode : Downloading mode (No: 0, only contacts: 1, yes: 2)
  • MiniMode : Allow MiniCalaméo (yes: 1 ; no: 0)
  • AdultMode : Adult content (yes: 1 ; no: 0)
  • ReadingMode : Play mode (From left to right: 0, from right to left: 1)
  • LicensingMode : Licence (none: leave empty ; pd (public domain) ; Creative commonsby / by_nc / by_nc_nd / by_nc_sa / by_nd / by_sa)
  • LogoUrl : Custom logo URL
  • LogoLink : Custom logo link
  • BackgroundUrl : Custom background URL
  • MusicUrl : Custom background music URL
  • MusicMode : Background music mode (loop: 0, play once:1)
  • SoundEffectMode : Sound effects modes (yes: 1 ; no: 0)
  • FlipSoundUrl : Custom page flipping sound URL

Response

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 File ID.
Book

In case of failure, not present.

In case of success, array with the following elements:

  • Code : Unique identifying key for the publication.
  • Name : Title of the publication.
  • Description : Description of the publication.
  • IsPrivate : Sends 1 if the publication is private and 0 if not.
  • AllowMini : Sends 1 if the publication allows access to the miniCalaméo and 0 if not.
  • Date : Date of citation of the publication.
  • Creation : Date of creation of the publication.
  • Modification : Date of the last modification of the publication.
  • PublicUrl : Absolute URL for the publication’s overview.
  • ViewUrl : Absolute URL for the publication’s reading page.
  • CommentsUrl : Absolute URL for the publication’s comments.
ErrorCode Error code. Empty if success.

An error message is sent back in case of problems.

Example

<!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://www.calameo.com/api/?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.publish';
$cid1 = $client->addAttachment('', 'c:/my_first_document.pdf');
$doc1 = array(
'CID'		=> $cid1,
'Name'		=> 'My first document',
'Description'	=> 'This is the first document',
'Date'		=> '2007-12-24',
'IsPublished'	=> true,
'PublishingMode'=> 2,
'AdultMode'	=> 1
);
$cid2 = $client->addAttachment('', 'd:/my_second_document.doc');
$doc2 = array(
'CID'		=> $cid2,
'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 created!';
echo '</pre>';
}
}
?>
</body>
</html>