I experienced some trouble trying to delete a segment with the NSX-T Policy UI. There was an error message complaining about a virtual machine that was still attached to the segment. I verified this message by going into vCenter and checking all the virtual machines and I was sure there were no virtual machines connected to this segment.

I fired up postman and tried to delete the segment through the REST API and again I got the same error message.

I looked-up the API call in the online documentation and discovered that there's also a force delete option.

Force delete infra segment

Force delete bypasses validations during segment deletion. This may result in an inconsistent connectivity.

Request:

Method:
DELETE
URI Path(s):
/policy/api/v1/infra/segments/<segment-id>?force=true
 
Request Headers:
n/a
Query Parameters:
n/a
Request Body:
n/a

 

The segment was deleted successfully.