Add Monitor (XML API)

Last modified on July 26, 2024

To create a new monitor, send a POST request to /devices/upload with an XML body containing the monitor type, name, interval, and other configuration parameters.

Notes:

  • AlertSite XML API supports creating Web URL, API endpoint, email, FTP, TCP, DNS and ping monitors. To create DéjàClick, SoapUI and Selenium monitors, you can use the JSON API. BitBar monitors, security scans and ServerAgents cannot be created via API.

  • New monitors are set to use your account’s default monitoring locations. Changing monitor locations is not supported in the XML API, but is supported in the JSON API.

Syntax

Request URL

POST https://www.alertsite.com/restapi/devices/upload

Request Body

Below is a complete example with all supported XML tags and attributes. The monitor configuration is specified in the <TxnDetail> tag. You can start with this template, replace the values with yours, and delete the items you do not need.

For a description of the XML tags and attributes, see Monitor Data Fields. Note that some tags and attributes are specific to certain monitor types.

XML

<Upload>
   <TxnHeader>
      <Request>
         <Login>[email protected]</Login>
         <SessionID>1ae01751673e33eb</SessionID>

         <TxnHeader>
            <ObjDevice></ObjDevice>
            <TxnPlan>_PLAN_</TxnPlan>
            <TxnDetail
               Caching="n"
               DeviceType="w"
               Emailaddr="emailaddr.here"
               FullIP="111.222.333.444"
               FullpageTimeOut="30"
               HomeLocation="1"
               HttpFollowRedirect="y"
               HttpMethod="g"
               HttpVersion="1.1"
               Interval="5"
               IntervalFullpage="60"
               Keyword="abc"
               KeywordInvertMatch="y"
               KeywordType="PlainText"
               Monitor="y"
               MonitorLocations="0"
               MonitorType="I"
               Notify="y"
               NotifyContent="n"
               Password="roundtrip email password"
               PingError="n"
               POP3addr="pop3addr.here"
               Port="80"
               RealmPassword="basic auth password"
               RealmUserId="basic auth userid"
               Report302Errors="n"
               Report401Errors="n"
               ResolveDNS="y"
               RR2Enabled="n"
               SMTPaddr="smtpaddr.here"
               SSLCheckCertDate="y"
               TimeOut="30"
               TraceError="y"
               url="www.example.com"
               UserId="roundtrip email userid"
            />
            <TxnName>Widget Shopping Cart</TxnName>

            <!-- Optional assertions for API endpoint monitors -->
            <AssertionList>
               <Assertion>
                  <Source>Response</Source>
                  <Comparison>does not contain</Comparison>
                  <Value>error</Value>
               </Assertion>
               <Assertion>
                  <Source>JSON Response</Source>
                  <Property>store.book[0].title</Property>
                  <Comparison>equals</Comparison>
                  <Value>The Lord of the Rings</Value>
               </Assertion>
            </AssertionList>

         </TxnHeader>
      </Request>
   </TxnHeader>
   <Source>REST_Client</Source>
</Upload>

Response Body

On success, the operation returns the ID of the created monitor:

XML

<Response>
   <Status>0</Status>
   <Message>No errors.</Message>

   <SessionID>1ae01751673e33eb</SessionID>
   <ObjDevice>48423</ObjDevice>
   <ObjCust>24567</ObjCust>
   <Custid>C24567</Custid>
   <Company>WidgetWorld</Company>
   <CurrPlan></CurrPlan>
   <CurrInterval></CurrInterval>
   <AvailablePlans>WTP5-1.5x:1:1</AvailablePlans>
   <TxnOut></TxnOut>
</Response>

See Also

Edit Monitor
List Monitors
Get Monitor
Delete Monitor
Get Status
AlertSite XML API

Highlight search results