[Archivesspace_Users_Group] question about retrieving resources and their children

Chris Fitzpatrick Chris.Fitzpatrick at lyrasis.org
Thu May 15 06:10:19 EDT 2014



Hi Paul,


I don't think there is a way to do this currently for a resource in on REST call. I think the concern would be this could return a very large JSON response ( and load on the DB) , since resources can have a large number of children.


The current practice is to get the tree ( which returns URIs, titles, and some of the basic MD) and load the children as needed...


I just threw something together that might work for you here => https://gist.github.com/cfitz/e29389c3f3830f589700


It's in ruby and it requires the rest-client gem <https://github.com/rest-client/rest-client> .  ( $ gem install rest-client ... not to be confused with the annoyingly named "restclient" gem)


This will get a resource, then iterate through the children and merge in the their records and spit out the resource JSON files into a directory.

Hopefully it gives you the general idea...

Let me know if you have any questions...


best,chris

<https://github.com/rest-client/rest-client>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/attachments/20140515/30e3be6c/attachment.html>


More information about the Archivesspace_Users_Group mailing list