<html><body><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" <noah.huffman@duke.edu><br><b>To: </b>"Archivesspace Users Group" <archivesspace_users_group@lyralists.lyrasis.org><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:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Hi Ben,</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">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:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Something like:</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Georgia",serif;color:black">curl --output “EADfilename.xml” -H "X-ArchivesSpace-Session: $TOKEN" ‘http://aspace1prod.dlt.psu.edu:9089/repositories/3/resource_descriptions/9235.xml?numbered_cs=true’</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">This works for me in Windows Powershell.</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">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:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">The ASpace developer screencasts are a good reference if you haven’t seen them, particularly this one</span>
<span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><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:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">-Noah</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#404040">================</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#404040">Noah Huffman</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#404040">Archivist for Metadata and Encoding</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#404040">David M. Rubenstein Rare Book & Manuscript Library</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#404040">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:11.0pt;font-family:"Calibri",sans-serif;color:#404040">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:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"> </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:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> archivesspace_users_group-bounces@lyralists.lyrasis.org [mailto:archivesspace_users_group-bounces@lyralists.lyrasis.org]
<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:10.0pt;font-family:"Georgia",serif;color:black">Hey All,</span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Georgia",serif;color:black"> </span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;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:10.0pt;font-family:"Georgia",serif;color:black"> </span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Georgia",serif;color:black">Login:</span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Georgia",serif;color:black"> </span></p>
</div>
<div>
<p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.0pt;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:10.0pt;font-family:"Georgia",serif;color:black"> </span></p>
<p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.0pt;font-family:"Georgia",serif;color:black">Save token:</span></p>
<p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.0pt;font-family:"Georgia",serif;color:black"> </span></p>
<p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.0pt;font-family:"Georgia",serif;color:black">        token=*****</span></p>
<p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.0pt;font-family:"Georgia",serif;color:black"> </span></p>
<p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.0pt;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:10.0pt;font-family:"Georgia",serif;color:black"> </span></p>
<p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.0pt;font-family:"Georgia",serif;color:black">        curl -H "X-ArchivesSpace-Session: $token" 'http://aspace1prod.dlt.psu.edu:9089/repositories/3/resources/1352'</span></p>
<p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.0pt;font-family:"Georgia",serif;color:black"> </span></p>
<p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.0pt;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:10.0pt;font-family:"Georgia",serif;color:black"><br>
</span></b><span style="font-size:10.0pt;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:10.0pt;font-family:"Georgia",serif;color:black"><br>
<br>
</span></p>
<p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.0pt;font-family:"Georgia",serif;color:black">       curl -H "X-ArchivesSpace-Session: $token" 'http://aspace1prod.dlt.psu.edu:9089/repositories/3/resources?all_ids=true'</span></p>
<p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.0pt;font-family:"Georgia",serif;color:black"> </span></p>
<p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.0pt;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:10.0pt;font-family:"Georgia",serif;color:black"> </span></p>
<p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.0pt;font-family:"Georgia",serif;color:black">        curl --output “resource_#1.xml” -H "X-ArchivesSpace-Session: $TOKEN" 'http://aspace1prod.dlt.psu.edu:9089/repositories/3/resource_descriptions/$ids.xml?numbered_cs=true"</span></p>
<p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.0pt;font-family:"Georgia",serif;color:black"> </span></p>
<p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.0pt;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:10.0pt;font-family:"Georgia",serif;color:black"> </span></p>
<p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.0pt;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:10.0pt;font-family:"Georgia",serif;color:black"> </span></p>
<p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.0pt;font-family:"Georgia",serif;color:black">-Ben</span></p>
<p class="p1" style="margin:0in;margin-bottom:.0001pt"><span style="font-size:10.0pt;font-family:"Georgia",serif;color:black"><br>
<br>
</span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;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:10.0pt;font-family:"Georgia",serif;color:black"></span></p>
</div>
</div>
</div>


<br>_______________________________________________<br>Archivesspace_Users_Group mailing list<br>Archivesspace_Users_Group@lyralists.lyrasis.org<br>http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group<br></div><div><br></div></div></body></html>