Bulk delete controlled values

32 views
Skip to first unread message

David M. ZUCKERMAN

unread,
Dec 8, 2022, 2:45:53 PM12/8/22
to ArchivesSpace
Hi, 

I'm wondering if there is a way to bulk delete controlled values? We have a LARGE number (thousands) of "not used" values due to a huge import. These records were corrected and re-imported however the older unused values still exist and it would take forever to delete them in the UI. 

I've looked at the API but there doesn't appear to be a way to delete enumerations. I see I could suppress them in which case they won't show up as an option in the dropdown while editing a record but they'll still show up in the controlled value list. There is an option to update them but that won't delete them. 

I"m assuming I could find them in the database and delete them but I'm worried they may be referenced in multiple tables and not quite sure what the ramification of deleting them in the db might have. 

Thanks,
Dave


James Bullen

unread,
Dec 8, 2022, 5:30:06 PM12/8/22
to archiv...@googlegroups.com

Hi Dave,

To do this using the API, get the enumeration first:
GET /config/enumerations/1

Then edit the JSON, removing the offending items from the `values` array.

Then post the edited JSON:
POST /config/enumerations/1


Cheers,
James



--
You received this message because you are subscribed to the Google Groups "ArchivesSpace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to archivesspac...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/archivesspace/23c1c86b-e4fe-4e16-8075-5c197aa9ea61n%40googlegroups.com.

David M. ZUCKERMAN

unread,
Dec 8, 2022, 7:39:20 PM12/8/22
to ArchivesSpace
Thanks, I was thinking I had to use a call to delete a specific enumeration value instead of updating the entire enumeration value list. I'll do that. 

The offending items are the ones that are listed as "not used" in the UI. Do you know of a way to get a list of those enumeration values?  When I retrieve the enumerations it doesn't list whether the enumeration value is being used or not.

Thanks,
Dave

David M. ZUCKERMAN

unread,
Dec 8, 2022, 8:27:13 PM12/8/22
to ArchivesSpace
Testing it out the deletion process as you suggested worked. Unfortunately it gives a 500 "range error" when trying to process the massive one we'd like to update which has over 5500 enumeration values. I'm assuming it's failing because of the size.

James Bullen

unread,
Dec 9, 2022, 6:47:27 PM12/9/22
to archiv...@googlegroups.com

David M. ZUCKERMAN

unread,
Dec 12, 2022, 2:55:52 PM12/12/22
to ArchivesSpace
That fixed it. Thanks! 
Reply all
Reply to author
Forward
0 new messages