[Archivesspace_Users_Group] Question Regarding the REST API batch_imports Operation

Mayo, Dave dave_mayo at harvard.edu
Thu May 7 17:08:26 EDT 2020


I did a lot of this back in the day, but it’s been a while – IIRC

You post an array of objects matching the JSONModel schema in ArchivesSpace.  If you’re referencing existing objects in the system, you use the existing URI in refs, if you’re creating an object, you give it an arbitrary URI which will be replaced on ingest, and succeeding objects later in the array can reference that URI.

For example, in this case, https://github.com/smith-special-collections/aspace-utils/blob/smith/resource_parser.rb#L389, I give resource objects a URI that looks like "/repositories/import/resources/import_309r8sfoijw3409ruf0u40fg8" (using a UUID generator built into Ruby) so objects later in the import can refer to the resource.

Does that make sense?

--
Dave Mayo (he/him)
Senior Digital Library Software Engineer
Harvard University > HUIT > LTS

From: <archivesspace_users_group-bounces at lyralists.lyrasis.org> on behalf of James R Griffin III <jrg5 at princeton.edu>
Reply-To: Archivesspace Users Group <archivesspace_users_group at lyralists.lyrasis.org>
Date: Thursday, May 7, 2020 at 10:44 AM
To: Archivesspace Users Group <archivesspace_users_group at lyralists.lyrasis.org>
Subject: Re: [Archivesspace_Users_Group] Question Regarding the REST API batch_imports Operation

I am terribly sorry, I have now found that the payload is a JSON serialization of an array of  resource objects: https://github.com/archivesspace/archivesspace/blob/master/backend/spec/controller_batch_import_spec.rb#L41<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_archivesspace_archivesspace_blob_master_backend_spec_controller-5Fbatch-5Fimport-5Fspec.rb-23L41&d=DwMFAg&c=WO-RGvefibhHBZq3fL85hQ&r=_Mv1dY22K7jvT5MD7xjbvGVzRDOUMhx4WYcnPSIzYnE&m=SD1vNNnvW50K-2ToZ2LG6v0WMDzSvtWkVtPSUsGe1DQ&s=QuevSa2HLjrjx745CQYyv4Y0PbFk6qft2LAcQnWW3hA&e=>

Would one then model the payload as one of these arrays of JSON objects, each with a URI internal to the EAD file?
________________________________
From: James R Griffin III
Sent: Thursday, May 7, 2020 10:30 AM
To: Archivesspace Users Group <archivesspace_users_group at lyralists.lyrasis.org>
Subject: Question Regarding the REST API batch_imports Operation

Hello Everyone,

I have recently been reviewing the documentation for the REST API, and was looking to explore the possible usage of https://archivesspace.github.io/archivesspace/api/#import-a-batch-of-records<https://urldefense.proofpoint.com/v2/url?u=https-3A__archivesspace.github.io_archivesspace_api_-23import-2Da-2Dbatch-2Dof-2Drecords&d=DwMFAg&c=WO-RGvefibhHBZq3fL85hQ&r=_Mv1dY22K7jvT5MD7xjbvGVzRDOUMhx4WYcnPSIzYnE&m=SD1vNNnvW50K-2ToZ2LG6v0WMDzSvtWkVtPSUsGe1DQ&s=dGq0YS2NZFipST2vx-iyS3lD1XE3A2T2a6E7Iy0xGi8&e=>

Please forgive for my ignorance, but does the body of the POST request contain a payload of EAD XML? Would this be a string of concatenated EAD documents?

Additionally, my understanding is that the response from this request contains an identifier for the created object. As the job for importing the records would be asynchronous, should one poll for the status of this new object by repeatedly transmitting a GET request against https://archivesspace.github.io/archivesspace/api/#find-resources-by-their-identifiers<https://urldefense.proofpoint.com/v2/url?u=https-3A__archivesspace.github.io_archivesspace_api_-23find-2Dresources-2Dby-2Dtheir-2Didentifiers&d=DwMFAg&c=WO-RGvefibhHBZq3fL85hQ&r=_Mv1dY22K7jvT5MD7xjbvGVzRDOUMhx4WYcnPSIzYnE&m=SD1vNNnvW50K-2ToZ2LG6v0WMDzSvtWkVtPSUsGe1DQ&s=LwavToKOM3wrwCBI_w1mdTISdSY6miulhZo8KqzKCek&e=> until it has been fully imported?

Thank you for your patience and assistance.

Sincerely,
James


--

my.pronoun.is/he<https://urldefense.proofpoint.com/v2/url?u=http-3A__my.pronoun.is_he&d=DwMFAg&c=WO-RGvefibhHBZq3fL85hQ&r=_Mv1dY22K7jvT5MD7xjbvGVzRDOUMhx4WYcnPSIzYnE&m=SD1vNNnvW50K-2ToZ2LG6v0WMDzSvtWkVtPSUsGe1DQ&s=VAXnUY7ASb1LRVVD0sS85_MiV_hViNjFJg_Wo8nVv48&e=>

James R. Griffin III

Digital Infrastructure Developer

Princeton University Library<https://urldefense.proofpoint.com/v2/url?u=https-3A__library.princeton.edu_&d=DwMFAg&c=WO-RGvefibhHBZq3fL85hQ&r=_Mv1dY22K7jvT5MD7xjbvGVzRDOUMhx4WYcnPSIzYnE&m=SD1vNNnvW50K-2ToZ2LG6v0WMDzSvtWkVtPSUsGe1DQ&s=AlDdy2Ij2dQGDc3IUBtPd3VWC7xTPfWxTdInfSXAvAo&e=>

Princeton, NJ 08544

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


More information about the Archivesspace_Users_Group mailing list