LogicMonitor seeks to disrupt AI landscape with $800M strategic investment at $2.4B valuation to revolutionize data centers.

Learn More

Get Reports

Last updated on 09 August, 2022

You can use LogicMonitor’s REST API to programmatically get information about your LogicMonitor reports. You can either get a list of reports or you can get details for a particular report.

As with all of our API calls, authentication is required.

Get a list of Reports

Returns a list of reports

HTTP Method: GET

URI: /report/reports

Request Parameters: By default, a list of 50 reports will be returned.  You can include sort, filter, fields, size and offset parameters in your request to control what data is included in the response and how it is formatted.  Note that all query parameters should be URL encoded where necessary. Note that query parameters are not considered part of the resource path, and should not be included the calculation of the LMv1 authentication signature.

Property

Syntax

Description

Example URI

sort sort={+ or -}property Sorts the response by the property specified in either increasing (+) or decreasing (-) order /report/reports?sort=+name
filter filter=property{operator}value Filters the response according to the operator and value specified. Note that you can use * to match on more than one character.You can use the ‘.’ character to filter values within an object (e.g. custom properties), and multiple filters can be separated by a comma.

 

Operators include:

  • Greater than or equals: >:
  • Less than or equals: <:
  • Greater than: >
  • Less than: <
  • Does not equal: !:
  • Equals: :
  • Does not include: !~
  • Includes: ~
/report/reports?filter=type:Alert%20trends
fields fields={list of properties separated by commas} Filters the response to only include the following fields for each object /report/reports?fields=name,type
size size=integer The number of results to display. Max is 1000. /report/reports?size=5
offset offset=integer The number of results to offset the displayed results by /report/reports?offset=2

Get information about a particular report

Returns details for a particular report

HTTP Method:GET

URI: /report/reports/{id}

Examples

The following examples illustrate various GET requests to the reports resource:

Example Request 1: GET all Reports

The following Python script returns a list of all reports in the api.logicmonitor.com portal.

#!/bin/env python

import requests
import json
import hashlib
import base64
import time
import hmac

#Account Info
AccessId ='YQQ75w6Mxx9zWIeAMq5H'
AccessKey ='f)!Z}%spR=6en+4^s2$t32r-3=NpdQ]2T{-deI)8'
Company = 'api'

#Request Info
httpVerb ='GET'
resourcePath = '/report/reports'

#Construct URL 
url = 'https://'+ Company +'.logicmonitor.com/santaba/rest' + resourcePath

#Get current time in milliseconds
epoch = str(int(time.time() * 1000))

#Concatenate Request details
requestVars = httpVerb + epoch + resourcePath

print requestVars

#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.get(url, headers=headers)

#Print status and body of response
print('Response Status:',response.status_code)
print('Response Body:',response.content)
Python 3

Example Request 2: GET all Reports

The following Python script will return a list of all reports, where only the name, type and format are returned for each result and the results are sorted in descending order according to the name.

#!/bin/env python

import requests
import json
import hashlib
import base64
import time
import hmac

#Account Info
AccessId ='YQQ75w6Mxx9zWIeAMq5H'
AccessKey ='f)!Z}%spR=6en+4^s2$t32r-3=NpdQ]2T{-deI)8'
Company = 'api'

#Request Info
httpVerb ='GET'
resourcePath = '/report/reports'
queryParams = '?fields=name,type,format&sort=-name'

#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 + resourcePath

print requestVars

#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.get(url, headers=headers)

#Print status and body of response
print('Response Status:',response.status_code)
print('Response Body:',response.content)
Python 3

Example Request 3: GET one report

The following Python script will return the details for the report with id 1.

#!/bin/env python

import requests
import json
import hashlib
import base64
import time
import hmac

#Account Info
AccessId ='YQQ75w6Mxx9zWIeAMq5H'
AccessKey ='f)!Z}%spR=6en+4^s2$t32r-3=NpdQ]2T{-deI)8'
Company = 'api'

#Request Info
httpVerb ='GET'
resourcePath = '/report/reports/1'

#Construct URL 
url = 'https://'+ Company +'.logicmonitor.com/santaba/rest' + resourcePath 

#Get current time in milliseconds
epoch = str(int(time.time() * 1000))

#Concatenate Request details
requestVars = httpVerb + epoch + resourcePath

print requestVars

#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.get(url, headers=headers)

#Print status and body of response
print('Response Status:',response.status_code)
print('Response Body:',response.content)
Python 3

Example Response

The following is an example response for one of the example requests above:

Response Status: 200
Response Body: {
  "status" : 200,
  "errmsg" : "OK",
  "data" : {
    "id" : 1,
    "name" : "All Alerts from last 24 hours",
    "description" : "",
    "type" : "Alert",
    "groupId" : 0,
    "format" : "PDF",
    "delivery" : "email",
    "recipients" : [ {
      "type" : "admin",
      "method" : "email",
      "addr" : "sarah",
      "additionInfo" : "[email protected]"
    }, {
      "type" : "admin",
      "method" : "email",
      "addr" : "Bill",
      "additionInfo" : "[email protected]"
    }, {
      "type" : "arbitrary",
      "method" : "email",
      "addr" : "[email protected]",
      "additionInfo" : ""
    } ],
    "schedule" : "45 9 * * *",
    "lastmodifyUserId" : 4,
    "lastmodifyUserName" : "sarah",
    "enableViewAsOtherUser" : false,
    "userPermission" : "write",
    "lastGenerateOn" : 1466613956,
    "lastGenerateSize" : 92007,
    "lastGeneratePages" : 1,
    "customReportTypeId" : 0,
    "reportLinkNum" : 43,
    "dateRange" : "Last 24 hours",
    "groupFullPath" : "*",
    "deviceDisplayName" : "*",
    "dataSourceInstanceName" : "*",
    "dataPoint" : "*",
    "level" : "all",
    "sortedBy" : "count",
    "includePreexist" : false,
    "activeOnly" : false,
    "summaryOnly" : true,
    "ackFilter" : "all",
    "sdtFilter" : "all",
    "timming" : "overlap",
    "dataSource" : "*",
    "rule" : "*",
    "chain" : "*",
    "columns" : [ {
      "name" : "Alerts",
      "isHidden" : false
    }, {
      "name" : "Group",
      "isHidden" : false
    }, {
      "name" : "Device",
      "isHidden" : false
    }, {
      "name" : "Instance",
      "isHidden" : false
    }, {
      "name" : "Datapoint",
      "isHidden" : false
    }, {
      "name" : "Datasource",
      "isHidden" : false
    } ]
  }
}
In This Article