Daya Sagar Nune > WebService-Instagram-0.04 > WebService::Instagram

Download:
WebService-Instagram-0.04.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.04   Source  

NAME ^

WebService::Instagram - Simple Interface to Instagram oAuth API

VERSION ^

Version 0.03

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,

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

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

Step 4: Fetch API Resources

Fetch the protected resource.

        #Get authenticated user's feed
        my $search_result = $instagram->get( 'https://api.instagram.com/v1/users/self/feed' );

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.

syntax highlighting: