Get Config Data

Last updated on 29 November, 2020


You can use LogicMonitor’s REST API to programmatically get all config files for a ConfigSource instance. As with all of our API calls, authentication is required.

Resource Information

HTTP Method: GET




  • deviceId is the device id, which can be obtained via the Devices Resource
  • deviceDatasourceId is the id of the ConfigSource, which can be obtained via the Device Datasource Resource
  • instanceId is the id of the ConfigSource instance for which you want to retrieve a config, which you can get from the Instance resource

Request Parameters: By default, a list of 50 stored config results will be returned. You can include the following query parameters to control what data is included in the response and how it is formatted. Note that query parameters are not considered part of the resource path, and should not be included in the calculation of the LMv1 authentication signature.

Property Syntax Description Example URI
fields fields=list of properties separated by commas Filters the response to only include the following fields for each object /device/devices/12/devicedatasources/45/instances/67/config?fields=id,version,deltaConfig
sort sort={+ or -}property Sorts the response by the property specified in either increasing (+) or decreasing (-) order /device/devices/9/devicedatasources/65/instances/84/config?sort=-version
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: :
  • Includes: ~
  • Does not include: !~
size size=integer The number of results to display. Max is 1000. /device/devices/5/devicedatasources/65/instances/84/config?size=5
offset offset=integer The number of results to offset the displayed results by /device/devices/6/devicedatasources/65/instances/84/config?offset=2

Each config will include an id, version, timestamp, the configuration file text, the differences detected from the last version, and any alerts that were triggered based on the changes. To get only the latest version of a config, you can sort by version and limit the results to one by using the following query parameters: ?sort=-version&size=1


The following Python script will return config data for device 674, ConfigSource 14921, instance 210728286:

#!/bin/env python

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

#Account Info
AccessId ='48v2wRzfK94y53sq5EuF'
AccessKey ='H_D9i(f5~B^U36^K6i42=^nS~e75gy382Bf6{)P+'
Company = 'api'

#Request Info
httpVerb ='GET'
resourcePath = '/device/devices/674/devicedatasources/14921/instances/210728286/config'
queryParams = ''
data = ''

#Construct URL 
url = 'https://'+ Company +'' + resourcePath +queryParams

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

#Concatenate Request details
requestVars = httpVerb + epoch + data + resourcePath

#Construct signature
hmac1 =,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, data=data, headers=headers)

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