WWW::MediaTemple - A Perl interface to the Media Temple API
Version 0.02
use WWW::MediaTemple; my $api = WWW::MediaTemple->new( api_key => 'your_api_key' ); $api->setRootPasswd( serviceId => '000001', password => '!f4k3p455w0rd' );
This module is intended to provide an interface between Perl and the Media Temple API. The Media Temple API is a RESTful web service. In order to use this module you must provide an api key which requires a valid account. For more information please see http://wiki.mediatemple.net/w/Category:API
Creates and returns a new WWW::MediaTemple object
my $api= WWW::MediaTemple->new()
api_key => [your_api_key]
The api_key parameter is required. You must provide a valid key.
pretty_print => [true|false}
This parameter allows you to enable the pretty print function of the API. By default this parameter is set to true
wrap_root => [true|false]
This parameter defaults to 'true'. It wraps the json object with the root object name. Specifying 'false' will not wrap the object.
format => [json|xml]
The data format you intend PUT, POST and GET. Currently defaults to JSON
raw_data => [true|false]
Return raw data in xml and or json format opposed to an object
get the service info for all services
get a list of all service ids
get the service info for a single service
* serviceId (integer, required: true, default: none)
$obj->service( serviceId => 000001 );
get a list of valid service types
get a list of OS's that can be installed on a (ve)
create a new service
* serviceType (integer, required: true, default: none)
* primaryDomain (string, required: true(dv only), default: none, (ve) autogenerates a domain)
* operatingSystem (integer, required: true, default: Ubuntu 9.10 (16) )
$obj->addService( operatingSystem => 16, serviceType => 000001, primaryDomain => 'snakeoil.dom' );
reboot the specified service
* serviceId integer, required: true, default: none
$obj->reboot( serviceId => 000001 );
flushes the firewall rules on the specified service
$obj->flushFirewall( serviceId => 000001 );
adds temporary disk space for the specified service
$obj->addTempDisk( serviceId => 000001 );
set plesk password for the specified service
$obj->pleskPassword( serviceId => 000001 );
set the root password for the specified service
$obj->setRootPass( serviceId => 000001 );
get the stats for a single service
* start (integer, required: false, default: none, beginning range in epoch seconds)
* end (integer, required: false, default: none, end range in epoch seconds
* resolution (integer, required: false, default: 15, The interval of data points in seconds to request
* precision (integer, required: false, default: 2, Digits to the right of the decimal
* predefined (integer, required: false, default: get stats over a predefined range (5min, 1year)
* NOTE: When using a predefined range the start option will be ignored
start
$obj->stats( predefined => '5min', resolution => 10, precision => 5 );
get the service warnings for an account
get the service warning thresholds
convert API output into XML, JSON or raw output based on constructor parameters
N/A at the current point in time
No special configuration and or configuration files are needed. This module is intended to run in any and all environment.
This package is intended to be compatible with Perl 5.008 and beyond.
Please use https://forums.mediatemple.net to provide bug reports and or feedback concerning the API.
REST::Client, XML::Simple, JSON
http://mediatemple.net/api
The module is provided free of support however feel free to contact the author or current maintainer with questions, bug reports, and patches.
Considerations will be taken when making changes to the API. Any changes to its interface will go through at the least one deprecation cycle.
Copyright (c) 2011 (mt) Media Temple, INC.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.
Casey Vega <cvega@mediatemple.net>
To install WWW::MediaTemple, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::MediaTemple
CPAN shell
perl -MCPAN -e shell install WWW::MediaTemple
For more information on module installation, please visit the detailed CPAN module installation guide.