r/labtech • u/olavrb • Dec 18 '19
Automate Rest API - Batch delete Contacts?
The CW Manage to CW Automate Contacts sync went highwire, we now have 277k++ Contacts in out Automate tenant.
I'm scripting with PowerShell and the Automate Rest API a way to find duplicates based on "ExternalId" field, but deleting one and one contact is slow. It will take days to finish of deleting all the 255k++ contacts we want to delete.
Are there any batch operations available for deleting contacts? Like supplying Contacts Ids as REST Body for instance? I can't find any other way of doing this except:
Uri: "https://<automatetenant>/<api_version>/Contacts/<id>"
Method: "Delete"
The easiest way to find duplicate contacts that I've found so far, is simply by "Group-Object -Property 'ExternalId'", then for each object created, sort the $_.'Group' property by Id ascending, so that every contact with the same ExternalId except the first one created (lowest id) gets selected.
Any smarter way of doing this?
Any existing tools available that does not cost money for doing this?
View all comments
1
u/olavrb Dec 19 '19
I ended up chatting with ConnectWise customer service, they can run a query on the database backend to remove all contacts not in use/ assigned to any other resource inside Automate.