<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; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;"><div><div><div>Hi Ben,</div><div>I while back I wrote this pretty klunky Python script to do exports from AS. I’m sure someone who actually knows what they’re doing could probably improve it dramatically, but it might be a start:</div><div><a href="https://gist.github.com/helrond/1ef5b5bd47b47bd52f02">https://gist.github.com/helrond/1ef5b5bd47b47bd52f02</a></div><div><div><div><br></div><div>Hillel Arnold</div></div><div>Lead Digital Archivist</div><div>Rockefeller Archive Center</div></div></div></div><div><br></div><span id="OLK_SRC_BODY_SECTION"><div style="font-family:Calibri; font-size:11pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt"><span style="font-weight:bold">From: </span> Ben Goldman <<a href="mailto:bmg17@psu.edu">bmg17@psu.edu</a>><br><span style="font-weight:bold">Reply-To: </span> Archivesspace Users Group <<a href="mailto:archivesspace_users_group@lyralists.lyrasis.org">archivesspace_users_group@lyralists.lyrasis.org</a>><br><span style="font-weight:bold">Date: </span> Wednesday, January 21, 2015 at 8:57 AM<br><span style="font-weight:bold">To: </span> Archivesspace Users Group <<a href="mailto:archivesspace_users_group@lyralists.lyrasis.org">archivesspace_users_group@lyralists.lyrasis.org</a>><br><span style="font-weight:bold">Subject: </span> Re: [Archivesspace_Users_Group] curl help<br></div><div><br></div><div><div><div style="font-family: georgia,serif; font-size: 10pt; color: #000000"><div>Noah, thanks for the feedback. It's good to know I am on the right track. I was able to get that to work. And in fact, we were able to build on that and perform a mass export of the finding aids, though for some reason only 1914 of 1940 resources were exported. <br></div><div><br></div><div>Now I am wondering how I might adjust the script to export the XML file with a file name that uses the value of the resource's identifier field rather than the ASpace system identifier for the record. </div><div><br></div><div>I agree that it would be great to see the documentation on the API/cURL expand in the way you outline. I feel there is so much more I could do with the API, that I do not fully understand the capabilities here. I just know being able to mass export finding aids with one script is pretty damn cool.</div><div><br></div><div>Thanks,</div><div>Ben</div><div><br></div><div><br></div><hr id="zwchr"><div style="color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>From: </b>"Noah Huffman" <<a href="mailto:noah.huffman@duke.edu">noah.huffman@duke.edu</a>><br><b>To: </b>"Archivesspace Users Group" <<a href="mailto:archivesspace_users_group@lyralists.lyrasis.org">archivesspace_users_group@lyralists.lyrasis.org</a>><br><b>Sent: </b>Tuesday, January 20, 2015 9:32:56 AM<br><b>Subject: </b>Re: [Archivesspace_Users_Group] curl help<br><div><br></div><style><!--
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Georgia;
panose-1:2 4 5 2 5 4 5 2 3 3;}
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.p1, li.p1, div.p1
{mso-style-name:p1;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
span.EmailStyle19
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><div class="WordSection1"><p class="MsoNormal"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">Hi Ben,</span></p><p class="MsoNormal"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"> </span></p><p class="MsoNormal"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">I’m a curl novice too, but your last example should work to output a single EAD file to the current directory. The only thing I see is that in your example you
have a single quote to begin the URL and a double quote to end it. Maybe change the double quote at the very end to a single quote, or make both double quotes?</span></p><p class="MsoNormal"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"> </span></p><p class="MsoNormal"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">Something like:</span></p><p class="MsoNormal"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"> </span></p><p class="MsoNormal"><span style="font-size: 10pt; font-family: Georgia, serif; color: black;">curl --output “EADfilename.xml” -H "X-ArchivesSpace-Session: $TOKEN" ‘<a href="http://aspace1prod.dlt.psu.edu:9089/repositories/3/resource_descriptions/9235.xml?numbered_cs=true">http://aspace1prod.dlt.psu.edu:9089/repositories/3/resource_descriptions/9235.xml?numbered_cs=true</a>’</span></p><p class="MsoNormal"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"> </span></p><p class="MsoNormal"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">This works for me in Windows Powershell.</span></p><p class="MsoNormal"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"> </span></p><p class="MsoNormal"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">More generally, I think it would be helpful for noobs like us if the ASpace documentation included a short primer (with examples) on how to use curl to interact
with the API. This could supplement the existing API documentation at: <a href="http://archivesspace.github.io/archivesspace/doc/file.API.html" target="_blank">
http://archivesspace.github.io/archivesspace/doc/file.API.html</a></span></p><p class="MsoNormal"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"> </span></p><p class="MsoNormal"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">The ASpace developer screencasts are a good reference if you haven’t seen them, particularly this one</span><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"><a href="http://youtu.be/iKd4ZME1uIE?list=PLJFitFaE9AY_DDlhl3Kq_vFeX27F1yt6I" target="_blank">http://youtu.be/iKd4ZME1uIE?list=PLJFitFaE9AY_DDlhl3Kq_vFeX27F1yt6I</a></span></p><p class="MsoNormal"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"> </span></p><p class="MsoNormal"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">-Noah</span></p><p class="MsoNormal"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"> </span></p><p class="MsoNormal"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(64, 64, 64);">================</span></p><p class="MsoNormal"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(64, 64, 64);">Noah Huffman</span></p><p class="MsoNormal"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(64, 64, 64);">Archivist for Metadata and Encoding</span></p><p class="MsoNormal"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(64, 64, 64);">David M. Rubenstein Rare Book & Manuscript Library</span></p><p class="MsoNormal"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(64, 64, 64);">Duke University</span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#404040"><a href="mailto:noah.huffman@duke.edu" target="_blank"><span style="color:#404040">noah.huffman@duke.edu</span></a></span></p><p class="MsoNormal"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(64, 64, 64);">919-660-5982</span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#404040"><a href="http://library.duke.edu/rubenstein/" target="_blank"><span style="color:#404040">http://library.duke.edu/rubenstein/</span></a></span></p><p class="MsoNormal"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"> </span></p><p class="MsoNormal"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"> </span></p><p class="MsoNormal"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"> </span></p><p class="MsoNormal"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"> </span></p><div><div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in"><p class="MsoNormal"><b><span style="font-size: 11pt; font-family: Calibri, sans-serif;">From:</span></b><span style="font-size: 11pt; font-family: Calibri, sans-serif;"> <a href="mailto:archivesspace_users_group-bounces@lyralists.lyrasis.org">archivesspace_users_group-bounces@lyralists.lyrasis.org</a> [<a href="mailto:archivesspace_users_group-bounces@lyralists.lyrasis.org">mailto:archivesspace_users_group-bounces@lyralists.lyrasis.org</a>]
<b>On Behalf Of </b>Ben Goldman<br><b>Sent:</b> Monday, January 19, 2015 3:56 PM<br><b>To:</b> Archivesspace Users Group<br><b>Subject:</b> [Archivesspace_Users_Group] curl help</span></p></div></div><p class="MsoNormal"> </p><div><div><p class="MsoNormal"><span style="font-size: 10pt; font-family: Georgia, serif; color: black;">Hey All,</span></p></div><div><p class="MsoNormal"><span style="font-size: 10pt; font-family: Georgia, serif; color: black;"> </span></p></div><div><p class="MsoNormal"><span style="font-size: 10pt; font-family: Georgia, serif; color: black;">Wondering if anyone can help a cURL novice work through the process of exporting a finding aid from the API. I've reviewed some of the past emails on this subject from
Noah and Kevin but I am still hung up somewhere. A quick recap:</span></p></div><div><p class="MsoNormal"><span style="font-size: 10pt; font-family: Georgia, serif; color: black;"> </span></p></div><div><p class="MsoNormal"><span style="font-size: 10pt; font-family: Georgia, serif; color: black;">Login:</span></p></div><div><p class="MsoNormal"><span style="font-size: 10pt; font-family: Georgia, serif; color: black;"> </span></p></div><div><p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size: 10pt; font-family: Georgia, serif; color: black;"> curl -F password='***'
<a href="http://aspace1prod.dlt.psu.edu:9089/users/bmg17/login" target="_blank">http://aspace1prod.dlt.psu.edu:9089/users/bmg17/login</a></span></p><p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size: 10pt; font-family: Georgia, serif; color: black;"> </span></p><p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size: 10pt; font-family: Georgia, serif; color: black;">Save token:</span></p><p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size: 10pt; font-family: Georgia, serif; color: black;"> </span></p><p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size: 10pt; font-family: Georgia, serif; color: black;"> token=*****</span></p><p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size: 10pt; font-family: Georgia, serif; color: black;"> </span></p><p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size: 10pt; font-family: Georgia, serif; color: black;">Just to verify I know what I am doing, try retrieving a resource record:</span></p><p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size: 10pt; font-family: Georgia, serif; color: black;"> </span></p><p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size: 10pt; font-family: Georgia, serif; color: black;"> curl -H "X-ArchivesSpace-Session: $token" '<a href="http://aspace1prod.dlt.psu.edu:9089/repositories/3/resources/1352">http://aspace1prod.dlt.psu.edu:9089/repositories/3/resources/1352</a>'</span></p><p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size: 10pt; font-family: Georgia, serif; color: black;"> </span></p><p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size: 10pt; font-family: Georgia, serif; color: black;">Success: {"lock_version":0,"title":"Frederick R. Matson papers","publish":true,<strong><span style="font-family: Georgia, serif;"> etc.
etc. etc.</span></strong></span></p><p class="p1" style="margin:0in;margin-bottom:.0001pt"><b><span style="font-size: 10pt; font-family: Georgia, serif; color: black;"><br></span></b><span style="font-size: 10pt; font-family: Georgia, serif; color: black;">I'm not going to do a mass publish yet, but went ahead and retrieved all the ids anyway:</span></p><p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size: 10pt; font-family: Georgia, serif; color: black;"><br><br></span></p><p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size: 10pt; font-family: Georgia, serif; color: black;"> curl -H "X-ArchivesSpace-Session: $token" '<a href="http://aspace1prod.dlt.psu.edu:9089/repositories/3/resources?all_ids=true">http://aspace1prod.dlt.psu.edu:9089/repositories/3/resources?all_ids=true</a>'</span></p><p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size: 10pt; font-family: Georgia, serif; color: black;"> </span></p><p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size: 10pt; font-family: Georgia, serif; color: black;">A long list. Including a very short resource record with the id of 9235. Now I am wondering exactly how I put this together to export
just this one. This is the command mentioned in previous messages:</span></p><p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size: 10pt; font-family: Georgia, serif; color: black;"> </span></p><p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size: 10pt; font-family: Georgia, serif; color: black;"> curl --output “resource_#1.xml” -H "X-ArchivesSpace-Session: $TOKEN" '<a href="http://aspace1prod.dlt.psu.edu:9089/repositories/3/resource_descriptions/$ids.xml?numbered_cs=true">http://aspace1prod.dlt.psu.edu:9089/repositories/3/resource_descriptions/$ids.xml?numbered_cs=true</a>"</span></p><p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size: 10pt; font-family: Georgia, serif; color: black;"> </span></p><p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size: 10pt; font-family: Georgia, serif; color: black;">I assume if I'm just exporting one, I can replace '$ids" with the actual number (9235), and that the value following --output can be
whatever I want the finding aid file name to be. Is all this correct? And where would this actually output the file to?</span></p><p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size: 10pt; font-family: Georgia, serif; color: black;"> </span></p><p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size: 10pt; font-family: Georgia, serif; color: black;">Thanks, in advance, for any help.</span></p><p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size: 10pt; font-family: Georgia, serif; color: black;"> </span></p><p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size: 10pt; font-family: Georgia, serif; color: black;">-Ben</span></p><p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size: 10pt; font-family: Georgia, serif; color: black;"><br><br></span></p></div><div><p class="MsoNormal"><span style="font-size: 10pt; font-family: Georgia, serif; color: black;"> </span></p></div><div><p class="MsoNormal"><b><span style="font-family: Georgia, serif; color: black;">Ben Goldman</span></b><span style="font-family: Georgia, serif; color: black;"><br>
Digital Records Archivist<br>
Penn State University Libraries<br>
University Park, PA<br>
814-863-8333<br><a href="http://www.libraries.psu.edu/psul/speccolls.html" target="_blank">http://www.libraries.psu.edu/psul/speccolls.html</a><br><br></span><span style="font-size: 10pt; font-family: Georgia, serif; color: black;"></span></p></div></div></div><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><br></div><div><br></div></div></div></div></span></body></html>