In order to manage your device inventory effectively, you may need to delete a device's information. This guide will explain how to perform a deteletion of device data from the inventory.
Deleting Device Data
To permanently remove a device and all its related information from the inventory, use the
DELETE method to permanently remove a specific device, along with its associated data, from the system by providing the device's unique identifier.
import requests # Enter your hostname (for example: myserver.com or 127.0.0.1) hostname = 'enterHostname' # Enter a deviceID between the quotes. deviceID = 'enterDeviceID' # Set the base URL url = 'https://'+hostname+'/ot-base.example.com/api/v1/devices/'+ deviceID # Set the authentication credentials auth = ('', '') # Send the DELETE request response = requests.delete(url, auth=auth) # Check the response status code if response.status_code == 204: print('Device', deviceID, 'successfully deleted.') else: print('Error deleting device:', response.text)
Please sign in to leave a comment.