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

Mayo, Dave dave_mayo at harvard.edu
Mon Mar 9 12:35:33 EDT 2020

Hi Corey,

Splitting this into two sections – the first is a description of what’s happening and should immediately fix your current issue, the second is some advice going forward re: using ASnake.

You appear to have found a bug in the ASpace API! From what I can tell, all_ids is not actually correctly supported in ‘search/repositories’ – you’ll need to use paged access until this is fixed.  I'm going to file a ticket

There’s also a minor issue with your query – the type parameter actually takes an ARRAY of strings, not a single string – in terms of how this shows up in the URL, the request should look like:


And then you could change page to 2 to get the next page of results, etc.

BUT, section two: advice on how to do this easily! There’s two main things:

1. Pass parameters in as an argument to the function, rather than putting them in the URL

  client.get('search/repositories', params={"q": "ms945", "page": 1, "type[]": 'resource', 'page': 1})

ASnake is based on requests, so you can find specific documentation of how params works in the requests documentation.

Additionally, ASpace is set up to automatically handle array parameters, so you can actually do this (difference is to the type parameter):

client.get('search/repositories', params={"q": "ms945", "page": 1, "type": ['resource'], 'page': 1})

2. ASnake's client also has a function specifically to handle paged routes called get_paged - so if you can do this:

    for resource_json in client.get_paged('search/repositories', params={"q": "ms945", "type": ['resource']}):
        # do something with resource JSON

Let me know if you need more help, here are some pointers to relevant docs:


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