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 -
responsecode integer The expected HTTP response code. E.g. 200, 403, 302, etc. 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
sslvalidity integer Specify the minimum number of days SSL certificates must have remaining 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
cookies string Sends the contents of this parameter as an HTTP Cookie. Use the standard HTTP cookie format (key=val) Optional
useragent string Identifies the HTTP client as the specified user agent. A blank string is sent by default. Optional
timeout integer Number of seconds to complete the HTTP request / response, after which the test fails Optional 30

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)

The expected HTTP response code. E.g. 200, 403, 302, etc. Do not include the text that follows the code (integer, optional, default = 200)

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

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

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)

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

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

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