NAME

WebService::Instagram - Simple Interface to Instagram oAuth API

VERSION

Version 0.05

SYNOPSIS

Step 1: Get the authorization URL:

Get the AUTH URL to authenticate,

use WebService::Instagram;

my $instagram = WebService::Instagram->new(
	{
		client_id	=> 'xxxxxxxxxxxxxxx',
		client_secret	=> 'xxxxxxxxxxxxxxx',
		redirect_uri	=> 'http://domain.com',
	}
);

my $auth_url = $instagram->get_auth_url();
print Dumper $auth_url;

Step 2: Let the User authorize the API

Go to the above calculated URL in the browser, authenticate and save the code returned by the browser after authentication. You will need this to get access_token in Step 3.

The returned URL is usually of the form www.returnuri.com/?code=xxxxxxxxxxx

Step 3: Get and Set Access Token

Now using the code, fetch the access_token and set it to the object,

 	$instagram->set_code( $code ); #$code is fetched from Step 2.
	my $access_token = $instagram->get_access_token();

	#Set the access_token to $instagram object
	$instagram->set_access_token( $access_token );

Step 4: Fetch API Resources

Fetch the protected resource.

#Get information about the owner of the access_token.
my $search_result = $instagram->request( 'https://api.instagram.com/v1/users/self' );

SUBROUTINES/METHODS

get_auth_url

Returns the authorization URL that the user has to authorize against. Once authorized, the browser appends the code along to the redirect URL which will used for obtaining access_token later.

get_access_token

Once you have the code, you are ready to get the access_token.

request

Since you now have the access token, you can request all the resources on behalf of the API.

AUTHOR

Daya Sagar Nune, <dayanune at cpan.org>

SUPPORT

This module's source and other documentation is hosted at: https://github.com/odem5442/WebService-Instagram

LICENSE AND COPYRIGHT

Copyright 2013 Daya Sagar Nune.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.