NAME

Flickr::API2 - Perl interface to the Flickr API

SYNOPSIS

use Flickr::API2;

my $api = new Flickr::API2({'key'    => 'your_api_key',
                           'secret' => 'your_app_secret'});


my @photos = $api->people->findByUsername('wintrmute')
                 ->getPublicPhotos(per_page => 10);

for my $photo (@photos) {
  say "Title is " . $photo->title;
}

Individual photos can be retrieved by id like so:

my $p = $api->photos->by_id(1122334455);
say "Medium JPEG is " . $p->url_m;

To access the raw flickr API, use methods like:

my $response = $api->execute_method('flickr.test.echo', {
      'foo' => 'bar',
      'baz' => 'quux',
  }
);

DESCRIPTION

A simple interface for using the Flickr API.

The API calls are made via Perl helper methods, and the data returned is converted into Perl objects that can have further methods called upon them.

So for instance, you can fetch a user by username, by:

my $user = $api->people->findByUsername('wintrmute')

You can then ask for photos by that user, by calling:

my @photos = $user->getPublicPhotos;

And from there, you can query titles, URLs, etc of the photos with methods such as:

$photos[0]->title

So far only a few helper methods have been written, but more are coming. Patches adding functionality will be greatly appreciated!

METHODS

new

Constructor - takes arguments of: key (api key) secret (api key's secret) rest_uri (which URL at flickr to use - defaults to the correct value) auth_uri (which URL at flickr for authentication - defaults to correct value)

execute_method($method, $args)

Constructs a Flickr::API2::Request object and executes it, returning the response. Exceptions will be thrown if the request fails.

photos

Returns a Flickr::API2::Photos object, which can be used to perform various searches and stuff. See its docs for more info.

people

Returns a Flickr::API2::People object, which can be used to perform various searches and stuff. See its docs for more info.

interestingness

Returns a Flickr::API2::Interestingness object, which can be used to perform various searches and stuff. See its docs for more info.

raw

Returns a Flickr::API2::Raw object, which allows low-level Flickr API calls to be performed. See its docs for more info.

test

Returns a Flickr::API2::Test object, which allows test-related API calls to be performed.

REPOSITORY

Development is on-going at: https://github.com/TJC/Flickr-API2

AUTHOR

Version 2.xx copyright © 2011-2014 Toby Corkindale, <tjc@wintrmute.net>

Original version 1.xx copyright (C) 2004-2005, Cal Henderson, <cal@iamcal.com>

Original version included Auth API patches provided by Aaron Straup Cope

SEE ALSO

Flickr::API2::Request, Flickr::API2::Raw, Flickr::API2::Base, Flickr::API2::People, Flickr::API2::User, Flickr::API2::Photos, Flickr::API2::Photo, Flickr::API2::Interestingness, http://www.flickr.com/, http://www.flickr.com/services/api/