Add Websites
Last updated - 23 July, 2025
You can use LogicMonitor’s REST API to programmatically add new ping checks and web checks to your LogicMonitor account.
Add a Website
Add a new ping or web check
HTTP Method:POST
URI: /service/services
Request Parameters:You can POST the following properties for a new website
Property |
Description |
Required? |
Values |
Type |
| name | The name of the website | Yes | Service names are restricted to numbers, letters, and – and _ symbols | String |
| type | The type of the website | Yes | ping | webservice | String |
| isInternal | Whether or not the website is internal | No. | true | false. Defaults to false. | Boolean |
| description | The description of the website | No | This value defaults to a blank String | String |
| serviceFolderId | The Id of the folder that the website is in | No | This value defaults to 1 | Integer |
| stopMonitoring | If this value is true, monitoring is disabled for the website. Note that if monitoring is disabled then alerting will also be disabled for the website. | No | true | false. This value defaults to false | Boolean |
| disableAlerting | If this value is true, alerting is disabled for the website. Note that alerting will be disabled by default if monitoring is disabled for the website. | No | true | false. This value defaults to false | Boolean |
| individualSmAlertEnable | Indicates whether an alert will be triggered if the website fails a check from an individual test location. | No | true | false. This value defaults to false | Boolean |
| individualAlertLevel | The level of alert to trigger if the website fails a check from an individual test location | No | warn | error | critical. This value defaults to warn | String |
| overallAlertLevel | The level of alert that is triggered if the website fails the number of check specified by transition from the test locations specified by globalSmAlertCond | No | warn | error | critical. This value defaults to warn | String |
| pollingInterval | How often the service is checked, in units of minutes. | No | 1-10 minutes. The value defaults to 5 | Integer |
| transition | The number of checks that must fail before an alert is triggered | No | 1-10, 30, 60. This value defaults to 0 | Integer |
| testLocation | The test locations from which the service should be monitored if the website is not internal, OR the Collectors that should monitor the website if the website is internal. | No | Collectors should be specified like this: “{\”collectorIds\”:[12,67]}”. Site Monitor locations include:
You can specify one or more of these locations like this: “{\”smgIds\”:[1,2,3]}” The default value is “{\”all\”:true}” |
JSON Object |
| globalSmAlertCond | The number of locations that the number of checks specified by transition must fail at in order to trigger an alert of severity overallAlertLevel. | No |
The default value is 0
|
Integer |
| useDefaultLocationSetting | Whether or not the website default locations should be used. | No | true | false. Defaults to false | Boolean |
| useDefaultAlertSetting | Whether or not the website default settings should be used. | No | true | false. Defaults to false | Boolean |
| serviceProperties | The properties associated with the website | No | – | JSON Object |
For new Ping Services the following additional POST properties apply:
Property |
Description |
Required? |
Values |
Type |
| count | The number of packets to send in the request | No | This value defaults to 5 | Integer |
| host | The hostname or IP | Yes | – | String |
| percentPktsNotReceiveInTime | The percentage of packets that should be returned in the time period specified by timeoutInMSPktsNotReceive for each ping check. | No | Defaults to 80 | Integer |
| timeoutInMSPktsNotReceive | The time period that the percentage of packets specified by percentPktsNotReceiveInTime must be returned in for each ping check. | No | Defaults to 500 | Integer |
For new Web Services the following additional POST properties apply:
Property |
Description |
Required? |
Values |
Type |
| steps | An object comprising one or more steps, see the table below for the properties included in each step | Yes | See table below for more detail | JSON Object |
| ignoreSSL | Whether or not SSL should be ignored for each check | No | true | false. Defaults to false | Boolean |
| pageLoadAlertTimeInMS | The time in milliseconds that the page must load within for each step to avoid triggering an alert. | No | Defaults to 30000 | Integer |
The JSON object “steps” comprises one or more steps, where each step has the following properties:
Property |
Description |
Required |
Values |
Type |
| HTTPHeaders | The headers included in the HTTP request to the web service | No | Any valid HTTP Header. E.g. “HTTPHeaders”:”Content-Type: application/json”. This value defaults to an empty string | String |
| statusCode | The expected response status code for the HTTP request made to the web service. Multiple status codes may be separated by commas | No | This value defaults to a blank String | String |
| followRedirection | If this value is true, the HTTP request to the web service will follow any redirects in place | No | true | false. This value defaults to false | Boolean |
| matchType | The type of interpretation method used to search for the keyword in the response | No |
This value defaults to plain |
String |
| keyword | A string keyword that must be present in the response to the HTTP request made to the web service | No | This value defaults to a blank String | String |
| HTTPBody | The data in the body of the HTTP request to the web service | No | This value defaults to an empty string | String |
| HTTPMethod | The HTTP request method used in the request to the web service | No | GET | HEAD | POST. This value defaults to GET | String |
| postDataEditType | The format of the POST data | No | raw | json | xml | x-www-form-urlencoded | String |
| url | The URL for the step. This should be the full url (i.e. domain + path) | Yes | – | String |
| fullpageLoad | If this value is true then the HTTP request will wait for all page elements to load | No | true | false. This value defaults to false | Boolean |
| requireAuth | If this value is true then Authorization is required for the HTTP request to the web service | No | true | false. This value defaults to false | Boolean |
| auth | The authentication information required if requireAuth=true | No | The following parameters must be specified in this object:
e.g. “auth”:{“type”:”common”,”userName”:”test”,”password”:”example”} |
JSON Object |
| invertMatch | If this value is true, the keyword should not be present in the response | No | true | false. This value defaults to false. | Boolean |
| timeout | The number of seconds that the page must load within before the request should time out | No | 1 | 5 | 15 | 30 | 60 | 120 | 180. This value defaults to 30. | Integer |
| HTTPVersion | The HTTP version used in the request to the web service | No | 1.0 | 1.1. This value defaults to 1.1 | String |
| schema | The schema or protocol associated with the URL | No | http | https. This value defaults to http | String |
| description | The description associated with the step | No | Defaults to a blank string | String |
| path | The path associated with the step, where the path is the URL component after the domain | No | This value will be inferred from the url | String |
| enable | true | false. Whether or not the step is enabled | No | Defaults to true | Boolean |
For examples of these resource properties, see this page.
Example 1: Add a Ping Service
The following Python request adds a Ping Service:
#!/bin/env python
import requests
import json
import hashlib
import base64
import time
import hmac
#Account Info
AccessId ='ACCESS_ID'
AccessKey ='ACCESS_KEY'
Company = 'COMPANY_NAME'
#Request Info
httpVerb ='POST'
resourcePath = '/service/services'
queryParams = ''
data='{"name":"newPingService","type":"ping","stopMonitoring":false,"disableAlerting":false,"pollingInterval":3,"host":"www.google.com"}'
#Construct URL
url = 'https://'+ Company +'.logicmonitor.com/santaba/rest' + resourcePath + queryParams
#Get current time in milliseconds
epoch = str(int(time.time() * 1000))
#Concatenate Request details
requestVars = httpVerb + epoch + data + resourcePath
#Construct signature
hmac1 = hmac.new(AccessKey.encode(),msg=requestVars.encode(),digestmod=hashlib.sha256).hexdigest()
signature = base64.b64encode(hmac1.encode())
#Construct headers
auth = 'LMv1 ' + AccessId + ':' + signature.decode() + ':' + epoch
headers = {'Content-Type':'application/json','Authorization':auth}
#Make request
response = requests.post(url, data=data, headers=headers)
#Print status and body of response
print('Response Status:',response.status_code)
print('Response Body:',response.content)Example 2: Add a Web Service
The following Python request adds a web service:
#!/bin/env python
import requests
import json
import hashlib
import base64
import time
import hmac
#Account Info
AccessId ='ACCESS_ID'
AccessKey ='ACCESS_KEY'
Company = 'COMPANY_NAME'
#Request Info
httpVerb ='POST'
resourcePath = '/service/services'
queryParams = ''
data='{"serviceFolderId":"1","type":"webservice","testLocation":"{\\"smgIds\\":[2, 3, 4]}","name":"ProdWebCheck","disableAlerting":true,"pollingInterval":5,"steps":[{"HTTPHeaders":"Content-Type:application/json","followRedirection":false,"keyword":"breaking","schema":"http","url":"www.google.com/#q=news","timeout":120},{"keyword":"california","url":"www.google.com/#q=states","invertMatch":true}]}'
#Construct URL
url = 'https://'+ Company +'.logicmonitor.com/santaba/rest' + resourcePath + queryParams
#Get current time in milliseconds
epoch = str(int(time.time() * 1000))
#Concatenate Request details
requestVars = httpVerb + epoch + data + resourcePath
#Construct signature
hmac1 = hmac.new(AccessKey.encode(),msg=requestVars.encode(),digestmod=hashlib.sha256).hexdigest()
signature = base64.b64encode(hmac1.encode())
#Construct headers
auth = 'LMv1 ' + AccessId + ':' + signature.decode() + ':' + epoch
headers = {'Content-Type':'application/json','Authorization':auth}
#Make request
response = requests.post(url, data=data, headers=headers)
#Print status and body of response
print('Response Status:',response.status_code)
print('Response Body:',response.content)