Media Temple API PHP Client


Browse by products and services

READ ME FIRST

This article is provided as a courtesy. Installing, configuring, and troubleshooting third-party applications is outside the scope of support provided by (mt) Media Temple. Please take a moment to review the Statement of Support.

This user-generated PHP class covers all the functions of the Media Temple API v1.0 (beta) as published on 2/14/2011.

The class is divided into two parts. The first covers the Services API, the second the Stats API.

Download

Download the PHP Class from GitHub: https://github.com/OyoKooN/PHP_mt_API

How it works

Instantiate the object passing your API Key and optionally your service ID.

 
$mt = new MtAPI('FbDgBldQMoKLwIXsBwq...', XXXXX); // Where XXXXX is an int
 

Set your Service ID anytime by calling the following method.

 
$mt->set_service_id(YYYYY); // Where YYYYY in an int
 

Access technical information with the following methods.

Set options with the following.

 
$url = $mt->servicesAPI(); // Return the URL of the Services API
$url = $mt->statsAPI() // Return the URL of the Stats API
$code = $mt->lastStatusCode(); // Return the last HTTP code (int)
$call = $mt->lastAPICall(); // Return the last API URL called
 

Services API

Use the following functions to interact with the Services API.

FunctionDescriptionParamsRequire Service ID to be Set
add_service() Add a service to your account * int $service_type
* string $primary_domain (required for DV)
* int $os (optional, (ve) only)
No
get_os_list() Get available OS list None No
get_services_list() Get a list of your services None No
get_services_ids() Get the IDs of your services None No
get_service_details() Get the details of one of your services None Yes
reboot_service() Reboot your service None Yes
set_plesk_password() Change your Plesk password string $password Yes
set_root_password() Change the root password of your service string $password Yes
add_temp_disk() Add temporary disk space to your service None Yes
flush_firewall() Flush firewall rules of your service None Yes

Stats API

Use the following functions to interact with the Stats API.

FunctionDescriptionParamsRequire Service ID to be Set
get_current_stats() Get current stats of your service None Yes
get_range_stats() Get stats of your service on a range of time * int $start (number of seconds since Epoch)
* int $end (number of seconds since Epoch)
* int $resolution (optional)
* int $precision (optional)
Yes
get_predefined_range_stats() Get stats of your service on a predefined range * string $range
* See Get Predefined Range Stats
Yes
get_warnings() Get the service's warnings None Yes
get_warnings_thresholds() Get the different warning thresholds None Yes