You can use LogicMonitor REST API v3 to add both internal and external Uptime web and ping devices to your LogicMonitor account.

Adding Uptime Internal Web Device

You can use LogicMonitor REST API v3 to add Uptime internal web devices. You must authenticate before making the API request.

URI: POST /device/devices

The following table describes parameters used in the API request:

ParameterTypeDescription
typeString Specify the Uptime device type.
Supported values are:
  • uptimewebcheck—Indicates Uptime web check device.
  • uptimepingcheck—Indicates Uptime ping check device.
  • Blank or empty value—Indicates a regular device.
Example—"type": "uptimewebcheck"
deviceTypeIntegerFor Uptime internal web check device, specify the device type as 18.
By default, the value is set to 0.
Example—"deviceType":18
nameStringName of the Uptime internal web check device that you want to add.
Example—"name": "Test-Web-Check-Int-V3-Int-New-4"
descriptionStringDescription of the Uptime internal web check device.
Example—"description": "Internal Web Check for google.com"
groupIdsList of StringA list of group IDs associated with the Uptime internal web check device.
For example, "groupIds": ["1","3774"] indicate that Uptime internal web check device is part of groupId “1” and “3774”.
Example—"groupIds": "3774"
isInternalBooleanFor Uptime internal web check device, set the value to true indicating that the device is monitored by an internal LogicMonitor Collector.
Example—"isInternal": true
individualSmAlertEnableBoolean You can associate Uptime internal web check device with a single or multiple LogicMonitor Collectors.
  • If set to true, an alert is triggered when a single Collector meets the alert condition.
  • If set to false, an alert is not triggered.
By default, the value is set to false.
Example—"individualSmAlertEnable": true
individualAlertLevelStringThe alert level set for individual instance if individualSmAlertEnable=true
Supported values are warn, error, and critical.
By default, the alert level is set to warn.
Example—"individualAlertLevel": "error"
overallAlertLevelStringThe alert level applied to the overall instance of the web check.
Supported values are warn, error, and critical.
By default, the alert level is set to warn.
Example—"overallAlertLevel": "warn"
pollingIntervalIntegerIndicates the interval (in minutes) of checking service on a regular basis. Supported polling interval must be between 1 to 10 minutes. The default polling interval is set to 5 minutes.
Example—"pollingInterval": 1
transitionIntegerThe number of checks that must fail before an alert is triggered.
Supported values are 110, 30, and 60.
By default, the number of check is set to 1 indicating that an alert is triggered immediately after the first occurrence of incorrect raw data.
Example—"transition": 1
globalSmAlertCondInteger Indicates the minimum number of test locations that must fail to trigger an alert.
Supported values are:
  • 0—All locations
  • 1—Half of the locations
  • 2—More than one location
  • 3—Any location
By default, the value is set to 0.
Example—"globalSmAlertCond": 1
useDefaultLocationSettingBooleanIndicate whether the website’s default location settings must be used when creating instances for the selected default checkpoints.
By default, the value is set to false, indicating that settings in the current request are used for instance creation.
Example—"useDefaultLocationSetting": false
useDefaultAlertSettingBooleanIndicate whether the website’s default alert settings must be applied to instances created for the selected checkpoints.
By default, the value is set to false, indicating that settings in the current request are applied to the instances.
Example—"useDefaultAlertSetting": false
testLocationJSON Object The location from which the configured check is monitored. For internal web check, configured collectorIds monitor the devices.
The following parameters must be specified in the JSON object:
  • all—Set to false when you provide collectorIds.
  • collectorIds—Provide a list of collectorIds.
  • smgIds—When adding Uptime internal web devices, smgIds must be empty.
Collectors must be specified as: “{\”collectorIds\”:[12,67]}”
By default, the value is set to “{\”all\”:true}”
Example—"testLocation": { "all": false, "collectorIds": [ 12248 ], "smgIds": [] }
propertiesList of Key ValueProperties linked with the web check. You must provide properties in the following format:[{name1, value1}, {name2, value2}]
Example—"properties": [{ "name": "testname", "value": "testvalue" }]
templateJSON ObjectA template to create website.
By default, the value is set to null.
Example—"template": null
stepsJSON Object An object comprising one or more steps.
  • type—The service step type. For Uptime internal web check device, the value is set to script.
    Example—"type": "script"
  • enable—Indicate whether the step must be enabled or disabled for use.
    By default, the step is enabled for use (that is, set to true).
    Example—"enable": true
  • useDefaultRoot—Indicate whether the ‘url’ must be suffixed to root url or not.
    For example, the domain (or root url) is www.google.com and the ‘url’ is ‘maps’. If useDefaultRoot is set to true, then during execution, it is considered as “www.google.com/maps
    By default, the value is set to false.
    Example—"useDefaultRoot": true
  • url—Specify full URL for the step. The URL must contain domain and path.
    Example—"url": "www.google.com" or "/maps"
  • HTTPVersion—The HTTP version used in the request for the web service.
    Supported versions are 1.0 and 1.1.
    By default, the value is set to 1.1
    Example—"HTTPVersion": "1.1"
  • HTTPMethod—The HTTP method used in the request for the web service. Supported methods are GET, HEAD, and POST.
    By default, the value is set to GET.
    Example—"HTTPMethod": "GET"
  • name—Name of the step.
    Example—"name": "__step0"
  • followRedirection—Indicates whether the check must follow HTTP redirects for the configured URL.
    • If set to true and the URL responds with a redirect (for example, 3xx status code), the check proceeds to the redirected destination URL.
    • If set to false, the check evaluates only the original URL and does not follow any redirects.

    By default, the value is set to true. Example—"followRedirection": true
  • fullpageLoad—Indicate whether the HTTP request to the web service must wait for the entire page including all dependent resources to fully load. This helps verify if all page components load successfully.
    • If set to true, the HTTP request waits for full page load.
    • If set to false, the check waits only for the initial response (typically, the base HTML) and does not wait for all page components to load.

    • By default, the value is set to false.
      Example—"fullpageLoad": false
  • requireAuth—Indicate whether user authentication is required for HTTP request for the web service.
    By default, the value is set to false indicating that user authentication is not required.
    Example—"requireAuth": true
  • auth—If requireAuth=true, then provide user authentication details. The following parameters must be specified in the JSON object:
    • type—Specify the authentication type. Supported authentication types are basic and ntlm. By default, the value is set to basic.
    • userName—Registered username to access configured check.
    • password—Password credential to access configured check.
    • domain— If type=ntlm, then specify the domain.

    Example—“auth”:{“type”:”common”,”userName”:”test”,”password”:”example”}
  • HTTPHeaders—The headers included in the HTTP request for the web service.
    By default, the header contains an empty string.
    Example—"HTTPHeaders": "Content-Type: application/json"
  • reqType—Supported request types are configand script.
    • If "reqType": "config", the functioning is similar to external web check. For more info, see <Adding Uptime External Web Devices>.
    • If reqType: "script" (supported only for internal web check), populate reqScripthaving the Groovy script used to process the request.
      For post data handling (postDataEditType), add the following details to the post data request:
      • If set to null, the HTTPBody contains raw request payload (free-form text)
      • If set to json, the HTTPBody must be in valid JSON format
      • If set to xml, the HTTPBody must be in valid XML format
      • If set to x-www-form-urlencoded, the HTTPBody must follow the key-value format. Example—name=website1
  • respType—Supported response types are configand script.
    If respType: "script" (supported only for internal web check), populate respScripthaving the Groovy script used to process and validate the response.
    Example—"respType": "script"
  • matchType—Specify the type of interpretation method that must be used for searching keywords in the response. Supported methods are as follows:
    • plain—Search for keywords in plain text.
    • namevalue—Search for keywords in key and value pair format.
    • xpath—Search for keywords in XML or HTML format.
    • json—Search for keywords in JSON format.
    • wildcard—Search for keywords usingglob expression.

    By default, the value is set to plain.
    Example—"matchType": "plain"
  • keyword—A string keyword that must be present in the response for the HTTP request made to the web service.
    By default, the keyword contains a blank string.
    Example—"keyword": ""
  • invertMatch—Indicate whether a check must pass if a keyword is found or not found in the response.
    • If set to true, the check passes only if the specified keyword is not found in the response.
    • If set to false, a check passes only if the specified keyword is found in the response.

    By default, the value is set tofalse.
    Example—"invertMatch": "false"
  • statusCode—The expected response status code for the HTTP request made to the web service. Multiple status codes are separated by commas.
    By default, the statusCode contains a blank string.
    Example—"statusCode": "200"
  • path—The path differs based on the matchType you have specified. It can be an XML path, JSON path, or key when the matchtypeis xpath, json, or namevalue. Here, keyword is searched in the HTTP response.
    Example—"path": ""
domainStringDomain or base URL of the website.
Example—"domain": "www.google.com"
ignoreSSLBooleanIndicate whether SSL must be ignored or applied for each web check.
By default, the value is set to false.
Example—"ignoreSSL": true
pageLoadAlertTimeInMSIntegerMaximum time (in milliseconds) a web page can load for each step before an alert is triggered.
By default, the value is set to 30000.
Example—"pageLoadAlertTimeInMS": 30000
schemaStringThe schema or protocol associated with the URL. Supported values are http and https.
By default, the value is set to http.
Example—"schema": "https"
alertExprString The SSL certificate alert threshold (in days). If triggerSSLExpirationAlert is true, then it is mandatory to specify value for alertExpr.
Example—"< 200 100 50"
  • A warning alert is triggered when less than 200 days remain prior to SSL certificate expiry.
  • An error alert is triggered when less than 100 days remain prior to SSL certificate expiry.
  • A critical alert is triggered when less than 50 days remain prior to SSL certificate expiry.
Example—"alertExpr": "< 30 25 15"
triggerSSLStatusAlertBoolean You can enable or disable alerts based on the current status of the SSL certificate.
  • If set to true, an alert is triggered if the SSL certificate is invalid due to reasons such as expired, revoked, or not trusted. This ensures security and validity of the SSL configuration.
  • If set to false, alerts indicating status of SSL certificate are not triggered.
By default the value set to false.
Example—"triggerSSLStatusAlert": false
triggerSSLExpirationAlertBoolean You can enable or disable alerts reminding of upcoming SSL certificate expiry.
  • If set to true, based on the configured thresholds, an alert is triggered prior to the SSL certificate expiry. This helps users to proactively renew the certificate and prevent downtime or security warnings.
  • If set to false, alerts reminding of upcoming SSL certificate expiry are disabled.
By default the value set to false.
Example—"triggerSSLExpirationAlert": false

The following Python script adds Uptime internal web device to your LogicMonitor account:

#!/bin/env python
 
import requests
import json
import hashlib
import base64
import time
import hmac
import getpass

#Account Info: LogicMonitor recommends to NEVER hardcode the credentials. Instead, retrieve the values from a secure storage.
#Note: The below is provided for illustration purposes only.
AccessId = getpass.getpass("Enter your AccessId: ")
AccessKey = getpass.getpass("Enter your AccessKey: ")
Company = 'COMPANY_NAME'  
 
#Request Info
httpVerb ='POST'
resourcePath = '/device/devices'
queryParams = ''
data = '{"type":"uptimewebcheck","deviceType":18,"id":0,"name":"UptimeInternalWebCheck","description":"","groupIds":["1"],"isInternal":true,"individualSmAlertEnable":true,"individualAlertLevel":"error","overallAlertLevel":"warn","pollingInterval":1,"transition":1,"globalSmAlertCond":0,"useDefaultLocationSetting":false,"useDefaultAlertSetting":false,"testLocation":{"all":true,"collectorIds":[4],"smgIds":[]},"properties":[],"template":null,"steps":[{"type":"script","enable":true,"useDefaultRoot":true,"url":"","HTTPVersion":"1.1","HTTPMethod":"GET","name":"__step0","followRedirection":true,"fullpageLoad":false,"requireAuth":false,"auth":{"domain":"","password":"","type":"basic","userName":""},"HTTPHeaders":"","reqType":"config","respType":"config","matchType":"plain","keyword":"","invertMatch":"false","statusCode":"","path":""}],"domain":"www.google.com","ignoreSSL":true,"pageLoadAlertTimeInMS":30000,"schema":"https","alertExpr":"","triggerSSLStatusAlert":false,"triggerSSLExpirationAlert":false}'
 
#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 
digest = hmac.new(
        AccessKey.encode('utf-8'),
        msg=requestVars.encode('utf-8'),
        digestmod=hashlib.sha256).hexdigest()
signature = base64.b64encode(digest.encode('utf-8')).decode('utf-8')  
 
#Construct headers
auth = 'LMv1 ' + AccessId + ':' + str(signature) + ':' + epoch
headers = {'Content-Type':'application/json','Authorization':auth,'X-Version':'3'}
 
#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)

Adding Uptime External Web Device

You can use LogicMonitor REST API v3 to add Uptime external web devices. You must authenticate before making the API request.

URI: POST /device/devices

The following table describes parameters used in the API request:

ParameterTypeDescription
typeString Specify the Uptime device type.
Supported values are:
  • uptimewebcheck—Indicates Uptime web check device.
  • uptimepingcheck—Indicates Uptime ping check device.
  • Blank or empty value—Indicates a regular device.
Example—"type": "uptimewebcheck"
deviceTypeIntegerFor Uptime external web check device, set the device type as 18.
By default, the value is set to 0.
Example—"deviceType":18
nameStringName of the Uptime external web check device that you want to add.
Example—"name": "Test-Web-Check-Ext-V3-Ext-New-5"
descriptionStringDescription of the Uptime external web check device.
Example—"description": "External Web Check for google.com"
groupIdsList of StringA list of group IDs associated with the Uptime external web check device.
For example, "groupIds": ["2","3775"] indicate that Uptime internal web check device is part of groupId “2” and “3775”.
Example—"groupIds": "3775"
isInternalBooleanFor Uptime external web check device, set the value to false indicating that the device is monitored by external Site Monitors located at various geographical regions.
Example—"isInternal": false
individualSmAlertEnableBooleanYou can associate Uptime external web check device with a single or multiple Site Monitors.
  • If set to true, an alert is triggered when a single Site Monitor meets the alert condition.
  • If set to false, an alert is not triggered.
By default, the value is set to false.
Example—"individualSmAlertEnable": true
individualAlertLevelStringThe alert level set for individual instance if individualSmAlertEnable=true
Supported values are warn, error, and critical.
By default, the alert level is set to warn.
Example—"individualAlertLevel": "error"
overallAlertLevelStringThe alert level applied to the overall instance of the web check.
Supported values are warn, error, and critical.
By default, the alert level is set to warn.
Example—"overallAlertLevel": "warn"
pollingIntervalIntegerIndicates the interval (in minutes) of checking service on a regular basis. Supported polling interval must be between 1 to 10 minutes.
By default, the polling interval is set to 5 minutes.
Example—"pollingInterval": 2
transitionIntegerThe number of checks that must fail before an alert is triggered.
Supported values are 110, 30, and 60.
By default, the number of check is set to 1 indicating that an alert is triggered immediately after the first occurrence of incorrect raw data.
Example—"transition": 1
globalSmAlertCondIntegerIndicates the minimum number of test locations that must fail to trigger an alert.
Supported values are:
  • 0—All locations
  • 1—Half of the locations
  • 2—More than one location
  • 3—Any location
By default, the value is set to 0.
Example—"globalSmAlertCond": 0
useDefaultLocationSettingBooleanIndicate whether the default location settings of the website must be used when creating instances for selected default checkpoints.
By default, the value is set to false, indicating that settings in the current request are used for instance creation.
Example—"useDefaultLocationSetting": false
useDefaultAlertSettingBooleanIndicate whether the default alert settings of the website must be applied to instances created for selected checkpoints.
By default, the value is set to false, indicating that settings in the current request are applied to the instances.
Example—"useDefaultAlertSetting": false
testLocationJSON ObjectThe location from which the configured check is monitored. For external web check, configured smgIds monitor the devices.
The following parameters must be specified in the JSON object:
  • all—Set to true when you provide smgIds.
  • collectorIds—When adding Uptime external web devices, collectorIds must be empty.
  • smgIds—Provide a list of smgIds
Site Monitor locations include:
  • 2—US – Washington DC
  • 3—US – Oregon
  • 4—Europe – Dublin
  • 5—Asia – Singapore
  • 6—Australia – Sydney
You can specify a single or multiple locations.
Example—“{\”smgIds\”:[2,3]}”
Note: You must encode the inner string.
By default, the value is set to “{\”all\”:true}”
Example—"testLocation": { "all": true, "collectorIds": [ ], "smgIds": [2,3,4] }
propertiesList of Key ValueProperties linked with the web check. You must provide properties in the following format:[{name1, value1}, {name2, value2}]
Example—"properties": [{ "name": "testname", "value": "testvalue" }]
templateJSON ObjectA template to create website.
By default, the value is set to null.
Example—"template": null
stepsJSON Object An object comprising one or more steps.
  • type—The service step type. For Uptime external web check device, the value is set to config.
    Example—"type": "config"
  • enable—Indicate whether the step must be enabled or disabled for use.
    By default, the step is enabled for use (that is, set to true).
    Example—"enable": true
  • useDefaultRoot—Indicate whether the ‘url’ must be suffixed to root url or not.
    For example, the domain (or root url) is www.google.com and the ‘url’ is ‘maps’. If useDefaultRoot is set to true, then during execution, it is considered as “www.google.com/maps
    By default, the value is set to false.
    Example—"useDefaultRoot": true
  • url—Specify full URL for the step. The URL must contain domain and path.
    Example—"url": "www.google.com" or "/maps"
  • HTTPVersion—The HTTP version used in the request for the web service.
    Supported versions are 1.0 and 1.1.
    By default, the value is set to 1.1
    Example—"HTTPVersion": "1.1"
  • HTTPMethod—The HTTP method used in the request for the web service. Supported methods are GET, HEAD, and POST.
    By default, the value is set to GET.
    Example—"HTTPMethod": "GET"
  • name—Name of the step.
    Example—"name": "__step0"
  • followRedirection—Indicates whether the check must follow HTTP redirects for the configured URL.
    • If set to true and the URL responds with a redirect (for example, 3xx status code), the check proceeds to the redirected destination URL.
    • If set to false, the check evaluates only the original URL and does not follow any redirects.

    By default, the value is set to true. Example—"followRedirection": true
  • fullpageLoad—Indicate whether the HTTP request to the web service must wait for the entire page including all dependent resources to fully load. This helps verify if all page components load successfully.
    • If set to true, the HTTP request waits for full page load.
    • If set to false, the check waits only for the initial response (typically, the base HTML) and does not wait for all page components to load.

    • By default, the value is set to false.
      Example—"fullpageLoad": false
  • requireAuth—Indicate whether user authentication is required for HTTP request for the web service.
    By default, the value is set to false indicating that user authentication is not required.
    Example—"requireAuth": true
  • auth—If requireAuth=true, then provide user authentication details. The following parameters must be specified in the JSON object:
    • type—Specify the authentication type. Supported authentication types are basic and ntlm. By default, the value is set to basic.
    • userName—Registered username to access configured check.
    • password—Password credential to access configured check.
    • domain— If type=ntlm, then specify the domain.

    Example—“auth”:{“type”:”common”,”userName”:”test”,”password”:”example”}
  • HTTPHeaders—The headers included in the HTTP request for the web service.
    By default, the header contains an empty string.
    Example—"HTTPHeaders": "Content-Type: application/json"
  • reqType—If "reqType": "config" for post data handling postDataEditType, add the following details to the post data request:
    • If set to null, the HTTPBody contains raw request payload (free-form text)
    • If set to json, the HTTPBody must be in valid JSON format
    • If set to xml, the HTTPBody must be in valid XML format
    • If set to x-www-form-urlencoded, the HTTPBody must follow the key-value format. Example—name=website1
    • Example—"reqType": "config"
  • respType—Specify the response type for the step.
    Example—"respType": "config"
  • matchType—Specify the type of interpretation method that must be used for searching keywords in the response. Supported methods are as follows:
    • plain—Search for keywords in plain text.
    • namevalue—Search for keywords in key and value pair format.
    • xpath—Search for keywords in XML or HTML format.
    • json—Search for keywords in JSON format.
    • wildcard—Search for keywords using glob expression.

    By default, the value is set to plain.
    Example—"matchType": "plain"
  • keyword—A string keyword that must be present in the response for the HTTP request made to the web service.
    By default, the keyword contains a blank string.
    Example—"keyword": ""
  • invertMatch—Indicate whether a check must pass if a keyword is found or not found in the response.
    • If set to true, the check passes only if the specified keyword is not found in the response.
    • If set to false, a check passes only if the specified keyword is found in the response.

    By default, the value is set tofalse.
    Example—"invertMatch": "false"
  • statusCode—The expected response status code for the HTTP request made to the web service. Multiple status codes are separated by commas.
    By default, the statusCode contains a blank string.
    Example—"statusCode": "200"
  • path—The path differs based on the matchType you have specified. It can be an XML path, JSON path, or key when the matchtypeis xpath, json, or namevalue. Here, keyword is searched in the HTTP response.
    Example—"path": ""
domainStringDomain or base URL of the website.
Example—"domain": "www.google.com"
ignoreSSLBooleanIndicate whether SSL must be ignored or applied for each web check.
By default, the value is set to false.
Example—"ignoreSSL": true
pageLoadAlertTimeInMSIntegerMaximum time (in milliseconds) a web page can load for each step before an alert is triggered.
By default, the value is set to 30000.
Example—"pageLoadAlertTimeInMS": 30000
schemaStringThe schema or protocol associated with the URL. Supported values are http and https.
By default, the value is set to http.
Example—"schema": "https"
alertExprStringThe SSL certificate alert threshold (in days). If triggerSSLExpirationAlert is true, then it is mandatory to specify value for alertExpr.
Example—"< 150 100 50"
  • A warning alert is triggered when less than 150 days remain prior to SSL certificate expiry.
  • An error alert is triggered when less than 100 days remain prior to SSL certificate expiry.
  • A critical alert is triggered when less than 50 days remain prior to SSL certificate expiry.
Example—"alertExpr": "< 35 25 15"
triggerSSLStatusAlertBoolean You can enable or disable alerts based on the current status of the SSL certificate.
  • If set to true, an alert is triggered if the SSL certificate is invalid due to reasons such as expired, revoked, or not trusted. This ensures security and validity of the SSL configuration.
  • If set to false, alerts indicating status of SSL certificate are not triggered.
By default the value set to false.
Example—"triggerSSLStatusAlert": false
triggerSSLExpirationAlertBoolean You can enable or disable alerts reminding of upcoming SSL certificate expiry.
  • If set to true, based on the configured thresholds, an alert is triggered prior to the SSL certificate expiry. This helps users to proactively renew the certificate and prevent downtime or security warnings.
  • If set to false, alerts reminding of upcoming SSL certificate expiry are disabled.
By default the value set to false.
Example—"triggerSSLExpirationAlert": false

The following Python script adds Uptime external web device to your LogicMonitor account:

#!/bin/env python
 
import requests
import json
import hashlib
import base64
import time
import hmac
import getpass

#Account Info: LogicMonitor recommends to NEVER hardcode the credentials. Instead, retrieve the values from a secure storage.
#Note: The below is provided for illustration purposes only.
AccessId = getpass.getpass("Enter your AccessId: ")
AccessKey = getpass.getpass("Enter your AccessKey: ")
Company = 'COMPANY_NAME'  
 
#Request Info
httpVerb ='POST'
resourcePath = '/device/devices'
queryParams = ''
data = '{"type":"uptimewebcheck","deviceType":18,"id":0,"name":"UptimeExternalWebCheck","description":"","groupIds":["1"],"isInternal":false,"individualSmAlertEnable":true,"individualAlertLevel":"error","overallAlertLevel":"warn","pollingInterval":1,"transition":1,"globalSmAlertCond":0,"useDefaultLocationSetting":false,"useDefaultAlertSetting":false,"testLocation":{"collectorIds":[],"collectors":[],"smgIds":["2","4","3"],"all":false},"properties":[],"template":null,"steps":[{"enable":true,"useDefaultRoot":true,"url":"","HTTPVersion":"1.1","HTTPMethod":"GET","name":"__step0","followRedirection":true,"fullpageLoad":false,"requireAuth":false,"auth":{"domain":"","password":"","type":"basic","userName":""},"HTTPHeaders":"","reqType":"config","respType":"config","matchType":"plain","keyword":"","invertMatch":"false","statusCode":"","path":""}],"domain":"google.com","ignoreSSL":true,"pageLoadAlertTimeInMS":30000,"schema":"https","alertExpr":"","triggerSSLStatusAlert":false,"triggerSSLExpirationAlert":false}'
 
#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 
digest = hmac.new(
        AccessKey.encode('utf-8'),
        msg=requestVars.encode('utf-8'),
        digestmod=hashlib.sha256).hexdigest()
signature = base64.b64encode(digest.encode('utf-8')).decode('utf-8')  
 
#Construct headers
auth = 'LMv1 ' + AccessId + ':' + str(signature) + ':' + epoch
headers = {'Content-Type':'application/json','Authorization':auth,'X-Version':'3'}
 
#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)