Requirement:How to delete an endpoint from database via an API call?
Solution:Removing an endpoint from database using tips api involves two steps,
- Do "deleteConfirm" to fetch the endpoint identifier(element_id).
- Delete an endpoint using the identifier fetched in step 1.
Configuration:Step 1: Getting the associated element_id of an endpoint.
Post the below content from any Linux machine to the ClearPass server to retrieve element_id.
curl -sk -u apiadmin:<password> -d '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<TipsApiRequest xmlns="http://www.avendasys.com/tipsapiDefs/1.0">
<TipsHeader version="6.4"/>
<Filter entity="Endpoint">
<Criteria fieldName="macAddress" filterString="<mac address>" match="contains"/>
</Filter>
</TipsApiRequest>' https://<ccpm_ip>/tipsapi/config/deleteConfirm/Endpoint
Ex: Retrieve the element_id associated to the MAC 00aa11bb22cc.
curl -sk -u apiadmin:password -d '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<TipsApiRequest xmlns="http://www.avendasys.com/tipsapiDefs/1.0">
<TipsHeader version="6.4"/>
<Filter entity="Endpoint">
<Criteria fieldName="macAddress" filterString="00aa11bb22cc" match="contains"/>
</Filter>
</TipsApiRequest>' https://192.168.1.1/tipsapi/config/deleteConfirm/Endpoint
Response will look like this,
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><TipsApiResponse xmlns="http://www.avendasys.com/tipsapiDefs/1.0"><TipsHeader exportTime="Wed Jun 22 18:07:36 IST 2016" version="6.5"/><StausCode>Success</StatusCode><EntityMaxRecordCount>1</EntityMaxRecordCount><Endpoints><Endpoint macAddress="00aa11bb22cc" status="Known"><element-id>Endpoint_00aa11bb22cc_Vz6</element-id><Endpointags tagName="test" tagValue="false"/></Endpoint></Endpoints><TagDictionaries><TagDictionary allowMultiple="false" mandatory="true" dataType="Boolean" attributeName="test" entityName="Endpoint"/>/TagDictionaries></TipsApiResponse>
Step 2: Delete the endpoint with the element_id returned from step 1.
Post the below content with the elemenet_id received from the above post to delete the endpoint.
curl -sk -u apiadmin:<password> -d '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<TipsApiRequest xmlns="http://www.avendasys.com/tipsapiDefs/1.0">
<TipsHeader version="6.4"/>
<Delete>
<Element-Id>Enter the element id here</Element-Id>
</Delete>
</TipsApiRequest>' https://<cppm_ip>/tipsapi/config/delete/Endpoint
Ex: Delete the MAC address 00aa11bb22cc
curl -sk -u apiadmin:eTIPS123 -d '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<TipsApiRequest xmlns="http://www.avendasys.com/tipsapiDefs/1.0">
<TipsHeader version="6.4"/>
<Delete>
<Element-Id>Endpoint_00aa11bb22cc_Vz6</Element-Id>
</Delete>
</TipsApiRequest>' https://10.17.164.221/tipsapi/config/delete/Endpoint
Response after deleting the mac address will look like,
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><TipsApiResponse xmlns="http://www.avendasys.com/tipsapiDefs/1.0"><TipsHeader exportTime="Wed Jun 22 18:12:36 IST 2016" version="6.5"/><StatusCode>Success</StatusCode><LogMessages><Message>Endpoint deleted successfully</Message></LogMessages></TipsApiResponse>
VerificationNote: This article covers the required details to delete/remove an endpoint from database. More supports on ClearPass API can be found in the below link.
https://support.arubanetworks.com/Documentation/tabid/77/DMXModule/512/Command/Core_Download/Default.aspx?EntryId=14976