NAME
WWW::Namecheap::Domain - Namecheap API domain methods
SYNOPSIS
Namecheap API domain methods.
See WWW::Namecheap::API for main documentation.
use WWW::Namecheap::Domain;
my $domain = WWW::Namecheap::Domain->new(API => $api);
$domain->check(...);
$domain->create(...);
...
SUBROUTINES/METHODS
WWW::Namecheap::Domain->new(API => $api)
Instantiate a new Domain object for making domain-related API calls. Requires a WWW::Namecheap::API object.
$domain->check(Domains => ['example.com'])
Check a list of domains. Returns a hashref of availablity status with domain names as the keys and 0/1 as the values for not available/available.
my $result = $domain->check(Domains => [qw(
    example.com
    example2.com
    foobar.com
)]);
Will give a $result something like:
$result = {
    'example.com' => 0,  # example.com is taken
    'example2.com' => 1, # example2.com is available
    'foobar.com' => 0,   # damn, foobar.com is taken
};
$domain->create(%hash)
Register a new domain name.
Example:
my $result = $domain->create(
    UserName => 'username',    # optional if DefaultUser specified in $api
    ClientIp => '1.2.3.4',     # optional if DefaultIp specified in $api
    DomainName => 'example.com',
    Years => 1,                                # required; default is 2
    Registrant => {
        OrganizationName => 'Example Dot Com', # optional
        JobTitle => 'CTO',                     # optional
        FirstName => 'Domain',
        LastName => 'Manager',
        Address1 => '123 Fake Street',
        Address2 => 'Suite 555',               # optional
        City => 'Univille',
        StateProvince => 'SD',
        StateProvinceChoice => 'S',            # optional; 'S' for 'State' or 'P' for 'Province'
        PostalCode => '12345',
        Country => 'US',
        Phone => '+1.2025551212',
        PhoneExt => '4444',                    # optional
        Fax => '+1.2025551212',                # optional
        EmailAddress => 'foo@example.com',
    },
    Tech => {
        # same fields as Registrant
    },
    Admin => {
        # same fields as Registrant
    },
    AuxBilling => {
        # same fields as Registrant
    },
    Billing => {
        # Optional; fields as Registrant except OrganizationName, JobTitle
    },
    Nameservers => 'ns1.foo.com,ns2.bar.com', # optional
    AddFreeWhoisguard => 'yes',               # or 'no', default 'no'
    WGEnabled => 'yes',                       # or 'no', default 'no'
    PromotionCode => 'some-string',           # optional
    IdnCode => '',                            # optional, see Namecheap API doc
    'Extended attributes' => '',              # optional, see Namecheap API doc
    IsPremiumDomain => '',                    # optional, see Namecheap API doc
    PremiumPrice => '',                       # optional, see Namecheap API doc
    EapFreee => '',                           # optional, see Namecheap API doc
);
Unspecified contacts will be automatically copied from Registrant, which must be provided.
Returns:
$result = {
    Domain => 'example.com',
    DomainID => '12345',
    Registered => 'true',
    OrderID => '12345',
    TransactionID => '12345',
    ChargedAmount => '10.45', # dollars and cents
};
$domain->getinfo(DomainName => 'example.com')
Returns a hashref containing information about the requested domain.
$domain->list(%hash)
Get a list of domains in your account. Automatically handles the Namecheap "paging" to get a full list. May be optionally restricted:
my $domains = $domain->list(
    ListType => 'ALL', # or EXPIRING or EXPIRED
    SearchTerm => 'foo', # keyword search
    SortBy => 'NAME', # or EXPIREDATE, CREATEDATE, or *_DESC
);
Returns an arrayref of hashrefs:
$domains = [
    {
        ID => '123',
        Name => 'example.com',
        User => 'owner',
        Created => 'MM/DD/YYYY',
        Expires => 'MM/DD/YYYY',
        IsExpired => 'false',
        IsLocked => 'true',
        AutoRenew => 'false',
        WhoisGuard => 'ENABLED',
    },
    ...
];
$domain->getcontacts(DomainName => 'example.com')
Get the contacts on file for the provided DomainName. Returns a big ol' data structure:
$contacts = {
    Domain => 'example.com',
    domainnameid => '12345',
    Registrant => {
        ReadOnly => 'false',
        ... all contact fields from create ...
    },
    Tech => {
        ... ditto ...
    },
    Admin => {
        ... ditto ...
    },
    AuxBilling => {
        ... ditto ...
    },
    WhoisGuardContact => {
        ... same contacts as outside, except the actual published
            WhoisGuard info, ReadOnly => 'true' ...
    },
};
$domain->setcontacts(%hash)
Set contacts for a domain name.
Example:
my $result = $domain->create(
    UserName => 'username', # optional if DefaultUser specified in $api
    ClientIp => '1.2.3.4', # optional if DefaultIp specified in $api
    DomainName => 'example.com',
    Registrant => {
        OrganizationName => 'Example Dot Com', # optional
        FirstName => 'Domain',
        LastName => 'Manager',
        Address1 => '123 Fake Street',
        Address2 => 'Suite 555', # optional
        City => 'Univille',
        StateProvince => 'SD',
        StateProvinceChoice => 'S', # for 'State' or 'P' for 'Province'
        PostalCode => '12345',
        Country => 'USA',
        Phone => '+1.2025551212',
        Fax => '+1.2025551212', # optional
        EmailAddress => 'foo@example.com',
    },
    Tech => {
        # same fields as Registrant
    },
    Admin => {
        # same fields as Registrant
    },
    AuxBilling => {
        # same fields as Registrant
    },
);
Unspecified contacts will be automatically copied from the registrant, which must be provided.
$result is a small hashref confirming back the domain that was modified and whether the operation was successful or not:
$result = {
    Domain => 'example.com',
    IsSuccess => 'true',
};
$domain->gettldlist()
Get a list of all TLDs available for registration, along with various attributes for each TLD. Results are automatically cached for one hour to avoid excessive API load.
$domain->transfer(%hash)
Initiate a transfer in request to Namecheap from another registrar. Request should look something like:
my $transfer = $domain->transfer(
    DomainName => 'example.com',
    Years => 1,
    EPPCode => 'foobarbaz',
);
The response will be a hashref:
$transfer = {
    Transfer => 'true',
    TransferID => '15',
    StatusID => '-1',
    OrderID => '1234',
    TransactionID => '1234',
    ChargedAmount => '10.10',
};
For transfer status code details, see the Namecheap API documentation:
https://www.namecheap.com/support/api/domains-transfer/transfer-statuses.aspx
$domain->transferstatus(TransferID => '1234')
Check the current status of a particular transfer. The TransferID is the TransferID returned by the transfer() call, or included in the transferlist(). Returns a hashref:
$result = {
    TransferID => '1234',
    Status => 'String',
    StatusID => '-1',
};
$domain->transferlist()
Retrieve a list of transfers associated with the connected API account. Automatically handles the Namecheap "paging" to get a full list. May be optionally restricted:
my $transfers = $domain->transferlist(
    ListType => 'ALL', # or INPROGRESS, CANCELLED, COMPLETED
    SearchTerm => 'foo', # keyword search
    SortBy => 'DOMAINNAME', # or TRANSFERDATE, STATUSDATE, *_DESC
);
Returns an arrayref of hashrefs:
$domains = [
    {
        ID => '123',
        DomainName => 'example.com',
        User => 'apiuser',
        TransferDate => 'MM/DD/YYYY',
        OrderID => 12345,
        StatusID => 20
        Status => 'Cancelled',
        StatusDate => 'MM/DD/YYYY',
        StatusDescription => 'String',
    }
    ...
];
$domain->api()
Accessor for internal API object.
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::Domain
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
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.