API Documentation

Your API-Keys ›

Code

PHP Wrapper

Adam Hopkinson has written a nice PHP wrapper class for the Zootool API called ZooPHP: http://adamhopkinson.co.uk/zoophp

$zoo = new ZooPHP($key, $secret);

$zoo->setAuth('username', 'password');
$zoo->setFormat('array');
$zoo->getUser('bastian');
$zoo->getUserFriends('bastian');
$zoo->getUserFollowers('bastian');
$zoo->getUserItems('bastian');
$zoo->getLatestItems();
$zoo->getItem('iw6og3');
$zoo->getPopularItems();
$zoo->addItem('http://adamhopkinson.co.uk', 'http://adamhopkinson.co.uk', 'zoophp,php,wrapper');


A second wrapper comes from Andy Wenk. Check it out over at Github: http://github.com/andywenk/ZootoolGatePHP

Ruby Gem

There's a great Ruby Gem by Ryan Mauer, which is available for Download over at Github: https://github.com/ryanmauer/zootool

require 'zootool'

# You'll access everything through a ZooApi object
zoo = Zootool::ZooApi.new('your_api_key_here')

# Example queries
my_items = zoo.users('rmauer').items
my_info = zoo.users('rmauer').info
my_friends = zoo.users('rmauer').friends
my_followers = zoo.users('rmauer').followers
my_inspiration_items = zoo.users('rmauer').items(:tag => 'inspiration')
all_inspiration_items = zoo.users.items(:tag => 'inspiration')
paged_items = zoo.users.items(:limit => 10, :offset => 20)
popular_today = zoo.items.popular('today')

# Using the returned data
first_title = popular_today[0]['title']
first_thumb = popular_today[0]['thumbnail']

Perl Wrapper

Josep Maria Roca has released a nice perl interface for Zootool, which is available over at Github: https://github.com/quelcom/Net-ZooTool

my $zoo = Net::ZooTool->new({ apikey   => $config{apikey} });

my $weekly_popular = $zoo->item->popular({ type => "week" });

# Info about a specific item
print Dumper($zoo->item->info({ uid => "6a80z" }));

# Examples with authenticated calls
my $auth_zoo = Net::ZooTool->new(
    {
        apikey   => $config{apikey},
        user     => $config{user},
        password => $config{password},
    }
);

my $data = $auth_zoo->user->validate({ username => $config{user}, login => 'true' });
print Dumper($data);

# In some methods authentication is optional.
# Public items only
my $public_items = $auth_zoo->user->items({ username => $config{user} });
# Include also your private items
my $all_items = $auth_zoo->user->items({ username => $config{user}, login => 'true' });

Python Wrapper

For all the Python guys Mark Rogers wrote a handy little Python wrapper: http://github.com/f4nt/pyzootool

from pyzootool import controller
zoocontrol = controller.ZooControl(apikey=YOUR_API_KEY)

## User information
followers = zoocontrol.user.get_user_followers('username')
friends = zoocontrol.user.get_user_friends('username')
userinfo = zoocontrol.user.get_userinfo('username')

## Items
popular_items = zoocontrol.item.get_popular('week')
user_items = zoocontrol.item.get_items_by_user('username')
item = zoocontrol.item.get_item('uid')

Objective-C Wrapper

Developing an iPhone, iPad or Mac app? Then you should definitely check out the ZTProxy wrapper by Nicolas Cormier: http://github.com/nicolascormier/ZTProxy

ZTProxy* prox = [ZTProxy defaultProxy];
NSURLCredential* cred = [NSURLCredential credentialWithUser:@"XXX" password:@"XXX" persistence:NSURLCredentialPersistencePermanent];
[prox useCredential:cred];
NSLog(@"%@", [prox userFollowersWithUsername:@"bastian" withRange:NSMakeRange(1, 2)]);

More wrappers

Did you build a wrapper for Ruby, C, Erlang or Turbo Pascal? Please let me know: zoopport@gmail.com

Advertisement via Carbon