API Documentation

Your API-Keys ›

Authentication

Digest

For some methods you will need to authenticate to get user specific data. I decided to use HTTP Digest as an easy to implement and yet secure way to authenticate users.

Specialties

Please make sure to encode the password as sha1 string and to set the username in lowercase, otherwise the authentication will fail. You also need to add login=true to your query if you want to make authenticated calls.

Example

Here's an easy example to make an authenticated API request with cURL and PHP.

<?php

$username = 'username';
$password = 'password';
$api_url  = 'http://zootool.com/api/users/items/?username=' . $username . '&apikey=###&login=true';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $api_url);

// HTTP Digest Authentication
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
curl_setopt($ch, CURLOPT_USERPWD, strtolower($username) . ':' . sha1($password));

curl_setopt($ch, CURLOPT_USERAGENT, 'My PHP Script');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$result = curl_exec($ch);
curl_close($ch);

$data = json_decode($result, true);

print_r($data);

?>

Advertisement via Carbon