Developers API

addHostSensor_HTTP

Adds an HTTP monitoring sensor to specified host.

Request Parameters

Parameter Data Type Description Required Default
hostid integer Unique ID of the host to which this sensor is being added Required -
url string The URL to be monitored. Use the complete url, including http:// or https:// for a secure connection Required -
nicename string A short, human readable description of this sensor Optional
timeout integer Number of seconds to complete the HTTP request / response, after which the test fails Optional 30
responsecode string The expected HTTP response code. E.g. 200, 403, 302, 2xx, 3xx or -1 to permit any. Do not include the text that follows the code Optional 200
verifysslcert boolean Whether to verify the validity of the SSL certificate presented by the (HTTPS) server Optional 1
searchheaders boolean If yes, expectedtext & unwantedtext will match content present in the HTTP response headers as well as the response body Optional
expectedtext string By including expected text, for the test to pass the supplied text must be found somewhere in the body of the HTTP response Optional
unwantedtext string Text that, if found in the HTTP response body, will cause the test to fail Optional
sslvalidity integer Specify the minimum number of days SSL certificates must have remaining Optional
cookies string Sends the contents of this parameter as an HTTP Cookie. Use the standard HTTP cookie format (key=val) Optional
postparams string If specified, an HTTP POST request will be made, using the contents as the POST data Optional
customrequestheaders string Override HTTP request headers, or use custom ones Optional
useragent string Identifies the HTTP client as the specified user agent. A blank string is sent by default. Optional
forceresolve string Override the IP address that the URL hostname resolves to. Useful to test specific servers in a CDN or load balancer and / or where SNI is in use. Optional

Response Data

Response Variable Data Type Description
errorcode integer Returns an errorcode of 0 if call is successful.
hostsensorid integer The unique ID corresponding to the newly created sensor
Try it out with the API Explorer:

Your API Key

API command to be called

Desired response format

Unique ID of the host to which this sensor is being added (integer)

The URL to be monitored. Use the complete url, including http:// or https:// for a secure connection (string)

A short, human readable description of this sensor (string)

Number of seconds to complete the HTTP request / response, after which the test fails (integer, optional, default = 30)

The expected HTTP response code. E.g. 200, 403, 302, 2xx, 3xx or -1 to permit any. Do not include the text that follows the code (string, optional, default = 200)

Whether to verify the validity of the SSL certificate presented by the (HTTPS) server (boolean, optional, default = 1)

If yes, expectedtext & unwantedtext will match content present in the HTTP response headers as well as the response body (boolean)

By including expected text, for the test to pass the supplied text must be found somewhere in the body of the HTTP response (string)

Text that, if found in the HTTP response body, will cause the test to fail (string)

Specify the minimum number of days SSL certificates must have remaining (integer)

Sends the contents of this parameter as an HTTP Cookie. Use the standard HTTP cookie format (key=val) (string)

If specified, an HTTP POST request will be made, using the contents as the POST data (string)

Override HTTP request headers, or use custom ones (string)

Identifies the HTTP client as the specified user agent. A blank string is sent by default. (string)

Override the IP address that the URL hostname resolves to. Useful to test specific servers in a CDN or load balancer and / or where SNI is in use. (string)