[Archivesspace_Users_Group] curl help

Ben Goldman bmg17 at psu.edu
Thu Jan 22 11:04:15 EST 2015


Thanks, Hillel. It looks far less klunky than what we've trying on our end. And thanks to Steve, as well, for sharing some additional resources. 

-Ben 

----- Original Message -----

From: "Hillel Arnold" <harnold at rockarch.org> 
To: "Archivesspace Users Group" <archivesspace_users_group at lyralists.lyrasis.org> 
Sent: Wednesday, January 21, 2015 12:28:03 PM 
Subject: Re: [Archivesspace_Users_Group] curl help 

Hi Ben, 
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: 
https://gist.github.com/helrond/1ef5b5bd47b47bd52f02 

Hillel Arnold 
Lead Digital Archivist 
Rockefeller Archive Center 

From: Ben Goldman < bmg17 at psu.edu > 
Reply-To: Archivesspace Users Group < archivesspace_users_group at lyralists.lyrasis.org > 
Date: Wednesday, January 21, 2015 at 8:57 AM 
To: Archivesspace Users Group < archivesspace_users_group at lyralists.lyrasis.org > 
Subject: Re: [Archivesspace_Users_Group] curl help 

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. 

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. 

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. 

Thanks, 
Ben 


----- Original Message -----

From: "Noah Huffman" < noah.huffman at duke.edu > 
To: "Archivesspace Users Group" < archivesspace_users_group at lyralists.lyrasis.org > 
Sent: Tuesday, January 20, 2015 9:32:56 AM 
Subject: Re: [Archivesspace_Users_Group] curl help 



Hi Ben, 



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? 



Something like: 



curl --output “EADfilename.xml” -H "X-ArchivesSpace-Session: $TOKEN" ‘ http://aspace1prod.dlt.psu.edu:9089/repositories/3/resource_descriptions/9235.xml?numbered_cs=true ’ 



This works for me in Windows Powershell. 



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: http://archivesspace.github.io/archivesspace/doc/file.API.html 



The ASpace developer screencasts are a good reference if you haven’t seen them, particularly this one http://youtu.be/iKd4ZME1uIE?list=PLJFitFaE9AY_DDlhl3Kq_vFeX27F1yt6I 



-Noah 



================ 

Noah Huffman 

Archivist for Metadata and Encoding 

David M. Rubenstein Rare Book & Manuscript Library 

Duke University 

noah.huffman at duke.edu 

919-660-5982 

http://library.duke.edu/rubenstein/ 










From: archivesspace_users_group-bounces at lyralists.lyrasis.org [ mailto:archivesspace_users_group-bounces at lyralists.lyrasis.org ] On Behalf Of Ben Goldman 
Sent: Monday, January 19, 2015 3:56 PM 
To: Archivesspace Users Group 
Subject: [Archivesspace_Users_Group] curl help 





Hey All, 





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: 





Login: 





curl -F password='***' http://aspace1prod.dlt.psu.edu:9089/users/bmg17/login 



Save token: 



token=***** 



Just to verify I know what I am doing, try retrieving a resource record: 



curl -H "X-ArchivesSpace-Session: $token" ' http://aspace1prod.dlt.psu.edu:9089/repositories/3/resources/1352 ' 



Success: {"lock_version":0,"title":"Frederick R. Matson papers","publish":true, etc. etc. etc. 


I'm not going to do a mass publish yet, but went ahead and retrieved all the ids anyway: 







curl -H "X-ArchivesSpace-Session: $token" ' http://aspace1prod.dlt.psu.edu:9089/repositories/3/resources?all_ids=true ' 



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: 



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 " 



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? 



Thanks, in advance, for any help. 



-Ben 











Ben Goldman 
Digital Records Archivist 
Penn State University Libraries 
University Park, PA 
814-863-8333 
http://www.libraries.psu.edu/psul/speccolls.html 





_______________________________________________ 
Archivesspace_Users_Group mailing list 
Archivesspace_Users_Group at lyralists.lyrasis.org 
http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group 


_______________________________________________ 
Archivesspace_Users_Group mailing list 
Archivesspace_Users_Group at lyralists.lyrasis.org 
http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/attachments/20150122/b2ad5544/attachment.html>


More information about the Archivesspace_Users_Group mailing list