Skip to main content

Example request

Keys & params​

Here are the public and secret keys we will use:

Public key84c92f2c5686d350d3d2d15c2073ec23
Private (secret) key1jHj0HORiWhpmw9QqOXsLoZjweVm7BWoT5WPWC2AbFsuWl95

In this example, we are going to list our account publications. The following parameters will be used:

apikey84c92f2c5686d350d3d2d15c2073ec23
actionAPI.fetchAccountBooks
outputJSON

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​

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();