Getting User Details
Last updated - 31 May, 2024
You can use LogicMonitor REST API v3 to get user details. You must authenticate yourself before making the API request.
Getting List of Users
By default, a list of 50 users is returned. You can include the following query parameters to control the kind of data to include in the response and how it is formatted.
Note: The query parameters are not part of the resource path and should not be included while calculating the LMv1 authentication signature.
URI: GET /setting/admins
Parameter | Type | Description |
type | String | This query parameter is used to filter users with bearer tokens. Example – url/setting/admins?type=bearer |
permission | String | This query parameter is used to filter users with traces permission. Example – url/setting/admins?permission=traces |
filterGroupString | String | This parameter is used to match the following filter values with multiple fields. * Admin firstName * Admin lastName * Admin userName * roleName assigned to Admin * Admin groupName * Admin status For example – url/setting/admins?filterGroupString=John Here, the value John is matched against all the above fields. |
fields | String | The response is filtered to include only the specified fields for each object. You can provide a list of properties separated by a comma. Example – /setting/admins?fields=id,username |
size | Integer | The number of results to display. A maximum of 1000 results can be requested in a GET call. By default, a list of 50 users is returned if a value is not provided for this parameter. Example – /setting/admins?size=30 |
offset | Integer | The number of result to offset the displayed result. Example – /setting/admins?offset=20 |
filter | String | The response is filtered according to the operator and specified value that is, filter=property:value
|
The following Python script gets all users in the account api.logicmonitor.com
#!/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 = 'apiAccount'
#Request Info
httpVerb ='GET'
resourcePath = '/setting/admins'
queryParams =''
data = ''
#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.get(url, data=data, headers=headers)
#Print status and body of response
print('Response Status:',response.status_code)
print('Response Body:',response.content)
Getting Details of a Specific User
URI: GET /setting/admins{ID}
Parameter | Type | Description |
id | Integer | (Mandatory) The ID of the user whose details you want to get. |
fields | String | The response is filtered to include only the specified fields for each object. You can provide a list of properties separated by a comma. Example – /setting/admins/id?fields=username,role |
The following Python script gets information about user 32 in account api.logicmonitor.com
#!/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 = 'apiAccount'
#Request Info
httpVerb ='GET'
resourcePath = '/setting/admins/32'
queryParams =''
data = ''
#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.get(url, data=data, headers=headers)
#Print status and body of response
print('Response Status:',response.status_code)
print('Response Body:',response.content)