Example request
Keys & params
Here are the public and secret keys we will use:
| Public key | 84c92f2c5686d350d3d2d15c2073ec23 |
| Private (secret) key | 1jHj0HORiWhpmw9QqOXsLoZjweVm7BWoT5WPWC2AbFsuWl95 |
In this example, we are going to list our account publications. The following parameters will be used:
| apikey | 84c92f2c5686d350d3d2d15c2073ec23 |
| action | API.fetchAccountBooks |
| output | JSON |
Signature
To calculate the signature of this request, we concatenate the API secret key with the name-value alphabetically sorted parameters:
1jHj0HORiWhpmw9QqOXsLoZjweVm7BWoT5WPWC2AbFsuWl95actionAPI.fetchAccountBooksapikey84c92f2c5686d350d3d2d15c2073ec23outputJSON
We get the MD5 hash of this string:
C867521B01925CE79E16FD630F2BE646
The complete request looks like this:
https://api.calameo.com/1.0?apikey=84c92f2c5686d350d3d2d15c2073ec23&action=API.fetchAccountBooks&output=JSON&signature=C867521B01925CE79E16FD630F2BE646
Stack request example
- Javascript
- PHP
- Python
const url = 'https://api.calameo.com/1.0?apikey=84c92f2c5686d350d3d2d15c2073ec23&action=API.fetchAccountBooks&output=JSON&signature=C867521B01925CE79E16FD630F2BE646';
async function getBooks() {
try {
const response = await fetch(url);
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const data = await response.json();
console.log(data);
} catch (error) {
console.error('Error:', error);
}
}
getBooks();
<?php
$url = 'https://api.calameo.com/1.0?apikey=84c92f2c5686d350d3d2d15c2073ec23&action=API.fetchAccountBooks&output=JSON&signature=C867521B01925CE79E16FD630F2BE646';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
if ($response === false) {
die('cURL error: ' . curl_error($ch));
}
curl_close($ch);
$data = json_decode($response, true);
var_dump($data);
import requests
url = 'https://api.calameo.com/1.0?apikey=84c92f2c5686d350d3d2d15c2073ec23&action=API.fetchAccountBooks&output=JSON&signature=C867521B01925CE79E16FD630F2BE646'
response = requests.get(url)
response.raise_for_status()
data = response.json()
print(data)