x
REST API Developer's Guide
- REST API Overview
- REST API v1
- REST API v1 Examples
- REST API v1 Status Codes
- Managing Ops Notes with the REST API
- Managing Alert Rules with the REST API
- Managing Alerts with the REST API
- Managing API Tokens with the REST API
- Accessing Audit Logs with the REST API
- Managing Collectors with the REST API
- Managing Collector Groups with the REST API
- Managing Dashboards and Widgets with the REST API
- Managing Dashboard Groups with the REST API
- Getting Data with the REST API
- Managing Datasources with the REST API
- Managing Datasource Instances with the REST API
- Managing Devices with the REST API
- Managing Device Groups with the REST API
- Get devices for a particular device group
- Get all alerts for a Device Group
- AWS Device Groups
- Delete Device Group Properties
- Update Device Group Properties
- Get Device Group Properties
- Add Device Group Properties
- Get all SDTs for a Device Group
- Delete a Device Group
- Get Device Groups
- Update a Device Group
- Add a Device Group
- About the Device Group Resource
- Managing Escalation Chains with the REST API
- Managing Reports with the REST API
- Managing Report Groups with the REST API
- Managing Roles with the REST API
- Managing SDTs with the REST API
- Managing Websites with the REST API
- Managing Website Groups with the REST API
- Getting Websites Test Locations with the REST API
- Managing Thresholds with the REST API
- Managing Users with the REST API
- REST API v2
- LogicMonitor SDKs
Delete a Device
You can use LogicMonitor's REST API to programmatically delete your LogicMonitor devices.
As with all of our API calls, authentication is required.
HTTP Method: DELETE
URI: /device/devices/<id>
Example
The following Python script will delete the device with id 425 in account api.logicmonitor.com:
#!/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 ='DELETE' resourcePath = '/device/devices/425' data = '' #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 + data + resourcePath #Construct signature signature = base64.b64encode(hmac.new(AccessKey,msg=requestVars,digestmod=hashlib.sha256).hexdigest()) #Construct headers auth = 'LMv1 ' + AccessId + ':' + signature + ':' + epoch headers = {'Content-Type':'application/json','Authorization':auth} #Make request response = requests.delete(url, data=data, headers=headers) #Print status and body of response print 'Response Status:',response.status_code print 'Response Body:',response.content