UptimeRobotApi class.

package WP-API-Libraries\WP-UptimeRobot-API

 Methods

Constructor.

__construct(string $api_key, string $format = 'json', integer $callback = null

Parameters

$api_key

string

API key to the account.

$format

string

XML or JSON.

$callback

integer

If specified, returns json wrapped in a callback with the name passed in.

Converts the alert type ID to its corresponding messages.

alert_type_tostring(Int $type) : String

Parameters

$type

Int

Alert type ID.

Returns

StringAlert type String (SMS|E-mail|Twitter DM|Boxcar|Web-Hook|Pushbullet|Zapier|Pushover|HipChat|Slack).

Alert contacts can be deleted using this method.

delete_alert_contact(array $args = array()) : array
API
api

Parameters

$args

array

Arguments for deleteAlertContact request.

Returns

arrayRequest results.

Monitors can be deleted using this method.

delete_monitor(integer $monitor_id) : array
API
api

Parameters

$monitor_id

integer

ID of monitor.

Returns

arrayRequest results.

Maintenance windows can be deleted using this method.

delete_mwindow(array $args = array()) : array
API
api

Parameters

$args

array

Arguments for deleteMWindow request.

Returns

arrayRequest results.

Alert contacts can be deleted using this method.

delete_psp(array $args = array()) : array
API
api

Parameters

$args

array

Arguments for deletePSP request.

Returns

arrayRequest results.

Alert contacts can be edited using this method.

edit_alert_contact(array $args = array()) : array
API
api

Parameters

$args

array

Arguments for editAlertContact request.

Returns

arrayRequest results.

Monitors can be edited using this method.

edit_monitor(array $args) : array
API

Important: The type of a monitor can not be edited (like changing a HTTP monitor into a Port monitor). For such cases, deleting the monitor and re-creating a new one is adviced.

api

Parameters

$args

array

Array of arguments to send into get_monitors.

Returns

arrayArray of monitor info.

Maintenance windows can be edited using this method.

edit_mwindow(array $args = array()) : array
API
api

Parameters

$args

array

Arguments for editMWindow request.

Returns

arrayRequest results.

Public status pages can be edited using this method.

edit_psp(array $args = array()) : array
API
api

Parameters

$args

array

Arguments for editPSP request.

Returns

arrayRequest results.

The list of alert contacts can be called with this method.

get_alert_contacts(array $args = array()) : array
API
api

Parameters

$args

array

Arguments for getAlertContacts request.

Returns

arrayRequest results.

Get monitor info.

get_monitors(array $args = array()) : array
API
api

Parameters

$args

array

Array of arguments to send into get_monitors.

Returns

arrayArray of monitor info.

The list of maintenance windows can be called with this method.

get_mwindows(array $args = array()) : array
API
api

Parameters

$args

array

Arguments for getMWindows request.

Returns

arrayRequest results.

The list of alert contacts can be called with this method.

get_psps(array $args = array()) : array
API
api

Parameters

$args

array

Arguments for getPSPs request.

Returns

arrayRequest results.

New alert contacts of any type (mobile/SMS alert contacts are not supported yet) can be created using this method.

new_alert_contact(array $args = array()) : array
API

The alert contacts created using the API are validated with the same way as they were created from uptimerobot.com (activation link for e-mails, etc.).

api

Parameters

$args

array

Arguments for newAlertContact request.

Returns

arrayRequest results.

New monitors of any type can be created using this method.

new_monitor(array $args) : array
API
api

Parameters

$args

array

Args to be sent into newMonitor request.

Returns

arrayRequest results.

New maintenance windows can be created using this method.

new_mwindow(array $args = array()) : array
API
api

Parameters

$args

array

Arguments for newMWindows request.

Returns

arrayRequest results.

New public status pages can be created using this method.

new_psp(array $args = array()) : array
API
api

Parameters

$args

array

Arguments for newPSP request.

Returns

arrayRequest results.

HTTP response code messages.

response_code_msg(string $code = '') : string
API
api

Parameters

$code

string

Response code to get message from.

Returns

stringMessage corresponding to response code sent in.

Converts the status ID to the corresponding status string.

status_tostring(integer $status) : string

Parameters

$status

integer

Status ID to convert.

Returns

stringStatus in string format ( Up|Down|Seems Down|Paused|Not Checked Yet|Not a Valid Status )

Fetch the request from the API.

fetch(string $request) : mixed

Parameters

$request

string

Request URL.

Returns

mixedRequest results.

Implode the array and deliminate the values with '-' or return the variable as is.

get_implode(array|string $var) : string

Parameters

$var

arraystring

Array to be imploded or a string to be sent back.

Returns

stringImploded string.

 Properties

 

API key

$api_key : string

Default

Static
 

Request POST args.

$args : array

Default

array()
 

URL to the API.

$base_uri : string

Default

'https://api.uptimerobot.com/v2'
 

Indicate if json respone should be wrapped in a callback.

$callback : integer

Default

Static
 

Return format. XML or JSON.

$format : string

Default

Static