Tim Wilde > WWW-Namecheap-API-0.05 > WWW::Namecheap::API

Download:
WWW-Namecheap-API-0.05.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 0.05   Source  

NAME ^

WWW::Namecheap::API - Perl interface to the Namecheap API

SYNOPSIS ^

Perl interface to the Namecheap API. API details at:

    https://www.namecheap.com/support/api/api.aspx

Actual API calls happen in the other modules in the distribution, which can be accessed via convenience methods from an API object. Brief example:

    use WWW::Namecheap::API;
    
    my $api = WWW::Namecheap::API->new(
        System => 'test',
        ApiUser => 'wwwnamecheapapi',
        ApiKey => 'keyhere',
        DefaultIp => '1.2.3.4',
    );
    
    my $result = $api->domain->check(Domains => ['example.com']);
    
    if ($result->{'example.com'}) {
        $api->domain->create(
            DomainName => 'example.com',
            Years => 1,
            Registrant => {
                OrganizationName => 'Foo Bar Inc.',
                FirstName => 'Joe',
                LastName => 'Manager',
                Address1 => '123 Fake Street',
                City => 'Univille',
                StateProvince => 'SD',
                PostalCode => '12345',
                Country => 'US',
                Phone => '+1.2125551212',
                EmailAddress => 'joe@example.com',
            },
        );
    }

GLOBAL PARAMETERS ^

There are a few parameters that can be included in any of the individual methods within the Namecheap API modules. These are listed below.

ClientIp

The client IP address for which this request is effective. If a DefaultIp was not provided when setting up the parent API object, this parameter is required, otherwise it is optional.

UserName

A sub-user (see WWW::Namecheap::User) under which the command should be performed. A DefaultUser may be specified at API object creation time; if one is not specified there, the default is to use the ApiUser unless a UserName is provided for the specific command being issued.

SUBROUTINES/METHODS ^

WWW::Namecheap::API->new(%hash)

Instantiate a new API object. Example:

    my $api = WWW::Namecheap::API->new(
        System  => 'test', # or 'prod' for production, default test
        ApiUser => 'username',
        ApiKey  => 'apikey',
        DefaultIp   => '1.2.3.4', # optional
        DefaultUser => 'otheruser', #optional, default ApiUser
        ApiUrl => 'https://foo.bar/', # overrides URL chosen by System
        Agent  => 'My API Agent/1.0', # optional, overrides default UA
    );

Only ApiUser and ApiKey are required, in which case System will default to 'test' and Agent defaults to 'WWW::Namecheap::API/$VERSION'. This API object will be passed to the constructors of the other classes in the distribution (or you can use its built-in convenience methods to get objects of those classes directly).

$api->request(%hash)

Send a request to the Namecheap API. Returns the XML response parsed into Perl form by XML::Simple. Intended for use by sub-classes, not outside calls. Parameters should be of the type and quantity required by the Namecheap API for the given Command. Example:

    my $xml = $api->request(
        Command => 'namecheap.domains.check',
        DomainList => 'example.com,example2.net',
        ClientIp => '1.2.3.4', # required if no DefaultIp in $api
    );

$api->domain()

Helper method to create and return a WWW::Namecheap::Domain object utilizing this API object. Always returns the same object within a given session via internal caching.

$api->dns()

Helper method to create and return a WWW::Namecheap::DNS object utilizing this API object. Always returns the same object within a given session via internal caching.

$api->error()

Returns the full XML response from the API if an error occurred during the request. Most likely key of interest is $xml->{Errors} and below.

AUTHOR ^

Tim Wilde, <twilde at cpan.org>

BUGS ^

Please report any bugs or feature requests to bug-www-namecheap-api at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-Namecheap-API. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT ^

You can find documentation for this module with the perldoc command.

    perldoc WWW::Namecheap::API

You can also look for information at:

ACKNOWLEDGEMENTS ^

LICENSE AND COPYRIGHT ^

Copyright 2011 Tim Wilde.

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: