[Archivesspace_Users_Group] Search Across Repositories and Get EAD XML - ArchivesSpace API

Mayo, Dave dave_mayo at harvard.edu
Mon Mar 9 12:46:14 EDT 2020

Oh, I missed the second part:

So, that endpoint returns the XML directly as the body of the response in memory.  The JSONDecodeError you’re getting is due to trying to decode this body as JSON, when what you actually have is XML!

If you want to save it to the filesystem, you just need to write it out:

response = client.get('repositories/5/resource_descriptions/5734.xml?include_unpublished=false&include_daos=true&numbered_cs=true&print_pdf=false&ead3=false')
with open('myfile.xml', 'wb') as f:

Keep in mind also the parameter-passing stuff from my other email, so the request there can be written as:

client.get('repositories/5/resource_descriptions/5734.xml', params={'include_unpublished': False, 'include_daos': True, 'numbered_cs': True, 'print_pdf': False, 'ead3': False})

Hope this helps!
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 Corey Schmidt <Corey.Schmidt at uga.edu>
Reply-To: Archivesspace Users Group <archivesspace_users_group at lyralists.lyrasis.org>
Date: Monday, March 9, 2020 at 10:39 AM
To: "archivesspace_users_group at lyralists.lyrasis.org" <archivesspace_users_group at lyralists.lyrasis.org>
Subject: [Archivesspace_Users_Group] Search Across Repositories and Get EAD XML - ArchivesSpace API

Dear ArchivesSpace Members,

Hello, my name is Corey Schmidt and I’m working as the ArchivesSpace Project Manager at the University of Georgia. I hope you all are doing well and having a good start to your week.

I have two questions about how to utilize the ArchivesSpace API. First, I want to use the https://urldefense.proofpoint.com/v2/url?u=https-3A__archivesspace.github.io_archivesspace_api_-23search-2Dacross-2Drepositories&d=DwMFAg&c=WO-RGvefibhHBZq3fL85hQ&r=_Mv1dY22K7jvT5MD7xjbvGVzRDOUMhx4WYcnPSIzYnE&m=B2y_0wn1HLyXldJyck05IgPrsrOCn8LyjRI8q5uSbtc&s=_eqqK2s6KdcWsYV9Ke0loG2mitQ-I_nV-F9VeT24-l0&e= API endpoint searching with the resource identifier and take the results to get the URI for that resource. How do I structure my call to the API using the ASnake client (in python)? I have tried the following code with response 400 returned:


Second, I want to download an EAD xml file directly from the API using this endpoint: https://urldefense.proofpoint.com/v2/url?u=https-3A__archivesspace.github.io_archivesspace_api_-23get-2Dan-2Dead-2Drepresentation-2Dof-2Da-2Dresource&d=DwMFAg&c=WO-RGvefibhHBZq3fL85hQ&r=_Mv1dY22K7jvT5MD7xjbvGVzRDOUMhx4WYcnPSIzYnE&m=B2y_0wn1HLyXldJyck05IgPrsrOCn8LyjRI8q5uSbtc&s=xwd2j6qv-zYs8pDbLpLM23dcSeDYcPUkZSAuio8FEVQ&e= XML. How do I specify where the EAD xml file saves to? I’m not even sure if it is saving anywhere on my computer. However, my requests are successful, generating a 200 response. I tried turning the response into json (using ASnake’s .json()) and writing it, but I keep getting a JSONDecodeError. This is my request:

     request_ead = client.get('repositories/5/resource_descriptions/5734.xml?include_unpublished=false&include_daos=true&numbered_cs=true&print_pdf=false&ead3=false')

Any help would be greatly appreciated!


Corey Schmidt
ArchivesSpace Project Manager | University of Georgia Libraries
Email: mailto:Corey.Schmidt at uga.edu
Phone: +1-706-542-8151

More information about the Archivesspace_Users_Group mailing list