This API allows you to add a website monitor
Sample Request
A sample request for adding a website monitor is given below:
http://site24x7.com/api/xml/addmonitor?apikey=[APIKEY]
Data Sent as POST parameters
&displayname=monitordisplayname&url=http://site24x7.com&groupname=monitorgroupname&pollinterval=10......
-- ** displayname, url, monitortype and poll interval fields are mandatory.
|
Example
<form method="POST" action="http://site24x7.com/api/xml/addmonitor?apikey=yourapikey">
DisplayName: <input type="text" name="displayname" value="monitordisplayname"><br>
URL: <input type="text" name="url" value="http://mydomain.com"><br>
Group Name: <input type="text" name="groupname" value="monitorgroupname"><br>
Monitor Type: <input type="text" name="monitortype" value="URL"><br>
Poll Interval: <input type="text" name="pollinterval" value="10"><br>
EMail: <input type="text" name="emaillist" value="name@domain.com,name2@domain.com,name3@domain.com"><br>
SMS: <input type="text" name="smslist" value="91-12221,91-3213123"><br>
Timeout: <input type="text" name="timeout" value="38"><br>
Primary Location: <input type="text" name="primarylocation" value="California"><br>
Secondary Locations: <input type="text" name="secondarylocation" value="London,Melbourne"><br>
Number of failures from Location: <input type="text" name="locationfailures" value="2"><br>
Number of failures before reporting down : <input type="text" name="maxfailurechecks" value="4"><br>
Form submission method : <input type="text" name="method" value="P"><br>
Query String : <input type="text" name="querystring" value=""><br>
Basic Authentication username: <input type="text" name="username" value="username"><br>
Basic Authentication password: <input type="text" name="password" value="password"><br>
User Agent: <input type="text" name="useragent" value="user agent"><br>
Header Name: <input type="text" name="headername" value="header name"><br>
Header Value: <input type="text" name="headervalue" value="header value"><br>
Case sensitivity: <input type="text" name="casesensitivity" value="yes"><br>
Availability string check : <input type="text" name="availablestringcheck" value="string1 string2 string3"><br>
Availability alert type: <input type="text" name="availabilityalerttype" value="trouble"><br>
UnAvailability string check : <input type="text" name="unavailablestringcheck" value="unavailability"><br>
Unavailability alert type: <input type="text" name="unavailabilityalerttype" value="trouble"><br>
RegEx: <input type="text" name="regex" value="<Regular_Expression"><br>
RegEx alerttype:<input type="text" name="regexalerttype" value="down"><br>
Response time threshold : <input type="text" name="responsetimecheck" value="300"><br>
Content change threshold : <input type="text" name="contentchangecheck" value="3"><br>
MD5 : <input type="text" name="md5check" value="true"><br>
<input type="submit" value="Add">
</form>
Request Parameters
The different parameters involved in the XML request are described below:
Field | Description |
displayname
| The display name of the monitor |
url
| The url to which the website points to |
groupname
| The monitor group to which the website monitor belongs. You can either enter an existing group name or a new group name. If the group name doesn't exist, it will be created.
|
monitortype
| Type of the monitor being added. Allowed values are URL,DNS,SMTP,HOMEPAGE,PORT,PORT-POP,PORT-SMTP,PING
|
pollinterval
| The interval at which the website needs to be monitored. Allowed values are 1, 5, 10, 15, 30, 60, 120, 180, 360 and 1440. All these values are in minutes.
|
emaillist
| The list of email contacts associated with the monitor. If there are multiple emails, then separate them with comma. If left alone, the primary master email contact will be receiving any monitor-specific alerts.
|
smslist
| The list of sms contacts associated with the monitor. If there are multiple sms contacts, then separate them with a comma.
|
timeout
| The default timeout value for the monitor. Maximum value for a monitor with 5-min interval or above is 90 minutes and max value for a 1-min monitor is 30 min.
|
primarylocation
| The monitoring location from which the url needs to be checked most often. Supported primary locations are California, New Jersey, Singapore, Texas, Netherlands, London,
Dallas,
Seattle, Chicago, Germany, South Africa, Australia,
Nagano, Shanghai,
India
|
secondarylocation
| The monitoring locations from where the rechecks will be done. Available locations are California, New Jersey, Singapore, Texas, Netherlands, London,
Dallas,
Seattle, Chicago, Germany, South Africa, Australia,
Nagano, Shanghai,
India
|
locationfailures
| The number of failures from each monitoring location. Specify 1 if you want alerts when monitor fails to respond from 1 location, 2 if you want it to check in 2 locations and vice versa. Max. value is 3.
|
maxfailurechecks
| The number of failures allowed before the site is reported as 'Down'. Values from 1 to 5. |
method
| The form submission method for the http/https url. Allowed values are P, G or H. P for a POST request, G for GET request and H for HEAD request.
|
querystring
| If the form submission method is POST, then specify the query string in this field. sample: param1=value1¶m2=value2¶m3=value3....
|
username
| The username of the website (if the site requires basic authentication) |
password
| The password of the website (if the site requires basic authentication)
|
casesensitivity
| To check the content matching keyword with case sensitivity. yes / no values will be allowed. |
useragent
| User agent to be used with the request
|
headername
| Maximum of 10 custom headers can be sent with the request.
|
headervalue
| header value corresponding to the header name specified in the headername list.
|
availablestringcheck
| The keywords/key phrases whose presence needs to checked for. To check multiple keywords, specify them separated by a space. If you want to test for a phrase, specify the phrase within double quotes. sample: string1 string2 "This is a phrase" "This again is a phrase" string3
|
availabilityalerttype
| This will send appropriate alert when content matching fails. trouble / down values will be allowed |
unavailablestringcheck
| The keywords/key phrases whose absence needs to be checked for. To check multiple keywords, specify them separated with a space. If you want to test for a phrase, specify the phrase within double quotes. sample: string1 string2 "This is a phrase" "This again is a phrase" string3 |
unavailabilityalerttype
| This will send appropriate alert on content matching succeeds. trouble / down values will be allowed |
regex
| To check the response content to match the regular expression pattern. Configure a Java based regular expression to check the content.
|
regexalerttype | This will send appropriate alert on regular expression does not match. trouble / down values will be allowed. |
responsetimecheck | The threshold value set for response time. This value will be in milliseconds. Eg: 3000 3000 will be for 3 secs |
contentchangecheck
| The threshold value set for content change notification. This will be depicted as the percentage change in the size of the web page. If you want to be alerted if the size of the web page changes by 20% then specify 20 in this field. Eg: 20
|
md5check
| The value to be specified to check if the web page has been modified. Allowed values are "true" or "false" |
Sample Success Response
The following code snippet provides the response in XML format:
<response uri="/api/xml/addmonitor" action="AddURL"> <result> <response>Successfully Added Monitor</response> </result> </response> |
Sample Error Response
In case of error conditions such as wrong value specified for 'method', the response will be of the form below:
<response uri="/api/xml/addmonitor">
<error>
<code>2801</code>
<message>
The value specified for method [Post] is wrong. Allowed values are P,G or H.
</message>
</error>
</response>