NAME
WebService::NFSN - Client for the NearlyFreeSpeech.NET API
VERSION
This document describes version 0.05 of WebService::NFSN, released April 25, 2008 as part of WebService-NFSN version 0.05.
SYNOPSIS
use WebService::NFSN;
my $nfsn = WebService::NFSN->new($USER, $API_KEY);
my $balance = $nfsn->account($ACCOUNT_ID)->balance;
DESCRIPTION
WebService::NFSN is a client library for NearlyFreeSpeech.NET's member API. It is only useful to people who have websites hosted at NearlyFreeSpeech.NET.
Much of this documentation was adapted from the original API documentation at https://api.nearlyfreespeech.net/.
INTERFACE
$nfsn = WebService::NFSN->new($USER, $API_KEY)
-
This constructs a new API manager object.
$USER
is your NFSN member login. You can get your$API_KEY
by making a Secure Support Request at https://members.nearlyfreespeech.net/support/request. $nfsn->account($ACCOUNT_ID)
-
Returns a WebService::NFSN::Account object for the specified account number (a string like
'A1B2-C3D4E5F6'
). $nfsn->dns($DOMAIN)
-
Returns a WebService::NFSN::DNS object for the specified domain (like
'example.com'
). $nfsn->email($DOMAIN)
-
Returns a WebService::NFSN::Email object for the specified domain.
$nfsn->member( [$USER] )
-
Returns a WebService::NFSN::Member object for the specified member login. If
$USER
is omitted, it defaults to the member login that was passed tonew
. $nfsn->site($SHORT_NAME)
-
Returns a WebService::NFSN::Site object for the specified site (identified by its short name).
$nfsn->last_response
-
Returns the HTTP::Response object containing the raw response from the last query sent to API.NearlyFreeSpeech.NET. You shouldn't normally need this, but it may be handy for debugging.
DIAGNOSTICS
WebService::NFSN::HTTPError
Most errors you might get from WebService::NFSN are Exception::Class based objects. WebService::NFSN::HTTPError is the abstract base class for these errors. The request
field contains the HTTP::Request object that failed, and the response
field contains the original HTTP::Response object.
WebService::NFSN throws errors from two classes derived from WebService::NFSN::HTTPError:
WebService::NFSN::LWPError
If WebService::NFSN cannot get a response from the NFSN server, it throws an error of class WebService::NFSN::LWPError. Examine the response
field for details.
WebService::NFSN::NFSNError
If the NFSN server returns an error response, it becomes an error of class WebService::NFSN::NFSNError. The error
and debug
fields contain the values received from NFSN. Any additional fields returned by NFSN are available in the nfsn
field (which is a hash reference). You can also examine the original response
.
Possible errors include:
The API request could not be authenticated
-
You're probably using the wrong member login or API key.
The authentication timestamp is out of range
-
The clocks of the NFSN API server and your computer need to be synchronised to within 5 seconds, and they aren't. You may need to set up NTP on your computer.
Simple Errors
The following errors do not use Exception::Class, because you should never see them unless you have an error in your program. They are classified like Perl's built-in diagnostics (perldiag):
(S) A severe warning
(F) A fatal error (trappable)
Missing required "%s" parameter for %s
-
(F) You failed to supply a parameter required by the method you called.
"%s" is not a parameter of %s
-
(S) You supplied a parameter not recognized by the method you called. This is only a warning; the parameter is still passed along to NFSN (in case it was added in a newer version of the API).
%s is read-only
-
(F) You tried to modify a read-only property.
%s is write-only
-
(F) You tried to read a write-only property.
CONFIGURATION AND ENVIRONMENT
WebService::NFSN requires no configuration files or environment variables.
DEPENDENCIES
Digest::SHA1, Exception::Class, JSON::XS, LWP (requires https
support), and URI. These are all available from CPAN.
INCOMPATIBILITIES
None reported.
BUGS AND LIMITATIONS
The server's SSL certificate is not verified, so WebService::NFSN is vulnerable to a man-in-the-middle attack. However, due to the design of NFSN's API, the attacker should only be able to monitor/suppress your queries and monitor/alter the responses. The attacker should not be able to send (properly authenticated) altered requests to the real NFSN server.
If someone knows how to have LWP verify the server's certificate, please let me know.
AUTHOR
Christopher J. Madsen <perl AT cjmweb.net>
Please report any bugs or feature requests to <bug-WebService-NFSN AT rt.cpan.org>
, or through the web interface at http://rt.cpan.org/Public/Bug/Report.html?Queue=WebService-NFSN
LICENSE AND COPYRIGHT
Copyright 2007 Christopher J. Madsen
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.