DeleteDevice

Modified on Tue, 27 Jun 2023 at 05:44 PM

The "DeleteDevice API" is a useful function for deleting single or multiple devices from the database without affecting the stability of the core server. It can be used to automate asset management systems and CMDBs to synchronize devices with Ivanti EPM.
Included since version:   4.5.31
API Endpoint:   http://coreservername/five9sWS/five9sWS.asmx
Parameter:   JSON-Structure
Usage:

The function is build in a JSON structure and uses the following (required) parameters:
1) Personal Access Token (PAT) which can be configured in the Admin section of the five(9)s Console under Role Based Administration
2) Array of computers to delete

Info:

The computer(s) to delete can be addressed by
ComputerIdn 

... or by one of the following additional attributes:
Hostname
Serialnumber
MAC Address

If you use a combination of these additional attributes, only devices that exactly match will be deleted.

Please ensure to deliver all required parameters and leave additional computer attributes empty if you do not need them. For ComputerIdn use 0 if you do not want to use this property.


{
  "PAT": "D6R78199296C0DFDE2C014SD921FB20BD0AC798109C897A1261",
  "ComputerDataToDelete": [
    {
      "Hostname": "HostSNA090",
      "SerialNumber": "",
      "MAC": "",
      "ComputerIdn": 0
    }
  ]
}


The deletion request will be queued in the five(9)s Consoles backend and processed asynchronous.
It can take up to 90 seconds for the background service to start working on the device deletion queue.

In case of an error, defined administrators receive an email.
You can configure the API email notification list by editing the settings.config or settings.yaml file. Simply add email addresses to the CreateUpdateDevicesEmailRecipients property. Multiple email addresses must be separated with a semicolon.

Get started with the following PowerShell:


$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Content-Type", "text/xml")
$headers.Add("Cookie", "ASP.NET_SessionId=dmky2w2t5al4q54rxz4u2dvh")

$body = "<?xml version=`"1.0`" encoding=`"utf-8`"?>
`n<soap:Envelope xmlns:xsi=`"http://www.w3.org/2001/XMLSchema-instance`" xmlns:xsd=`"http://www.w3.org/2001/XMLSchema`" xmlns:soap=`"http://schemas.xmlsoap.org/soap/envelope/`">
`n  <soap:Body>
`n      <DeleteDevices xmlns=`"http://www.five9s.de/`">
`n      <deleteDeviceDataAsJson>{
`n  `"PAT`": `"D678B99096EnterYourPatHere0201420BD0AC`",
`n  `"ComputerDataToDelete`": [
`n    {
`n      `"Hostname`": `"HostSNA090`",
`n      `"SerialNumber`": `"`",
`n      `"MAC`": `"`",
`n      `"ComputerIdn`": 0
`n    }
`n  ]
`n}</deleteDeviceDataAsJson>
`n    </DeleteDevices>
`n  </soap:Body>
`n</soap:Envelope>"

$response = Invoke-RestMethod 'http://coreserver/five9sWS/five9sWS.asmx?wsdl' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article