<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div><br></div><div>Apparently, there is also a /batch_delete method, but I haven’t yet managed to figure out</div><div>how to give it the correct record_uris parameter. I’ve tried several different ways of encoding</div><div>record_uris (as a plain string, a json string, a json list of strings… ), and several different resource URIs,</div><div>but I always seem to get something like:</div><div><br></div><div>{"error":{"record_uris":["Wanted type [String] but got '/repositories/25/resources/3610/tree'"]}}</div><div><br></div><div><br></div><div><h2 style="-webkit-print-color-adjust: exact; margin: 20px 0px 10px; padding: 0px; -webkit-font-smoothing: antialiased; cursor: text; position: relative; font-size: 24px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(204, 204, 204); font-family: Helvetica, arial, sans-serif; z-index: auto;">POST /batch_delete</h2><p style="-webkit-print-color-adjust: exact; margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px; line-height: 22px;"><strong style="-webkit-print-color-adjust: exact;">Description</strong></p><p style="-webkit-print-color-adjust: exact; margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px; line-height: 22px;">Carry out delete requests against a list of records</p><p style="-webkit-print-color-adjust: exact; margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px; line-height: 22px;"><strong style="-webkit-print-color-adjust: exact;">Parameters</strong></p><pre style="-webkit-print-color-adjust: exact; margin-top: 15px; margin-bottom: 15px; background-color: rgb(248, 248, 248); border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; overflow: auto; padding: 6px 10px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="-webkit-print-color-adjust: exact; margin: 0px; padding: 0px; border: none; background-color: transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">[String] record_uris -- A list of record uris
</code></pre><p style="-webkit-print-color-adjust: exact; margin: 15px 0px; font-family: Helvetica, arial, sans-serif; font-size: 14px; line-height: 22px;"><strong style="-webkit-print-color-adjust: exact;">Returns</strong></p><pre style="-webkit-print-color-adjust: exact; margin-top: 15px; margin-bottom: 15px; background-color: rgb(248, 248, 248); border: 1px solid rgb(204, 204, 204); font-size: 13px; line-height: 19px; overflow: auto; padding: 6px 10px; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><code style="-webkit-print-color-adjust: exact; margin: 0px; padding: 0px; border: none; background-color: transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">200 -- deleted
</code></pre></div><div><code style="-webkit-print-color-adjust: exact; margin: 0px; padding: 0px; border: none; background-color: transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><br></code></div><div><code style="-webkit-print-color-adjust: exact; margin: 0px; padding: 0px; border: none; background-color: transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;"><br></code></div><div><br></div><div>Also: attempting to delete an empty repository from the admin interface yields the error:</div><div><br></div><div><span style="color: rgb(185, 74, 72); font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 13px; line-height: 20px; background-color: rgb(242, 222, 222);">Cannot delete - repository not empty</span></div><div><br></div><div>even though the admin browse shows no Accessions, Resources or Digital Objects in the repo,</div><div>and API /repositories/:repo_id/resources?all_ids=true returns empty [ ] . </div><div><br></div><div>However, after doing a ‘transfer repository’ to another repo, I am able to delete the first repository. </div><div><br></div><div><br></div><div>Since we’re still testing, we’ve had to frequently resort to just deleting all of the mysql database </div><div>tables and starting over fresh. </div><div><br></div><div><br></div><div>— Steve. </div><div><br></div><br><div><div>On May 28, 2014, at 11:38 AM, Bridger Dyson-Smith <<a href="mailto:bdysonsm@utk.edu">bdysonsm@utk.edu</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">On 05/28/2014 11:36, Steven Majewski wrote:<br><blockquote type="cite"><br>On May 28, 2014, at 9:15 AM, Bridger Dyson-Smith <<a href="mailto:bdysonsm@utk.edu">bdysonsm@utk.edu</a><br><<a href="mailto:bdysonsm@utk.edu">mailto:bdysonsm@utk.edu</a>>> wrote:<br><br><blockquote type="cite">Hi all,<br><br>Is there a batch process for deleting/backing out of an import job? Or<br>is there some other work-around to accomplish a bulk resource removal?<br><br>Thanks!<br><br></blockquote><br>You can delete all of the resources in a repo thru the backend web api<br>with something like this:<br><br><br>REPO=<a href="http://localhost:8089">http://localhost:8089</a><br>#<br>REPO_ID=$1<br>#<br>DELETE='-X DELETE'<br>for ID in $( curl_as_osx admin admin<br>"$REPO/repositories/$REPO_ID/resources?all_ids=true" | tail -1 | tr<br>'[],' ' ' )<br>do<br>curl_as_osx admin admin $DELETE<br>$REPO/repositories/$REPO_ID/resources/$ID | tail -1 | json_pp<br>done<br><br><br>i.e. First curl gets the list of resource ids in that repo. Loop over<br>the list and do a HTTP DELETE on each resource.<br><br>If you don’t want to delete them all, there may be a way to do a finer<br>selection thru the search API, but I haven’t figure out how to do it.<br>Perhaps something like this is easier to do in the jirb console.<br><br><br>— Steve Majewski<br><br><br><br></blockquote>Hi Steve -<br>thanks for that snippet - it is much appreciated.<br><br>Bridger<br>_______________________________________________<br>Archivesspace_Users_Group mailing list<br><a href="mailto:Archivesspace_Users_Group@lyralists.lyrasis.org">Archivesspace_Users_Group@lyralists.lyrasis.org</a><br><a href="http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group">http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group</a></div></blockquote></div><br></body></html>