limit number of containers returned in API request

28 views
Skip to first unread message

Laurin Penland

unread,
Aug 15, 2025, 1:15:04 PMAug 15
to Archivesspace_Users_Group
Hi folks,

Is there a way to limit the number of top containers returned in an API request? I have a resource that has about 1,600 containers, and the request times out on my server. 
This is the API request that I am using: [:GET] /repositories/:repo_id/resources/:id/top_containers

I see in the ASpace API documentation that some requests include the ability to set a limit and an offset, but that does not appear to be the case for this kind of request?

Any help would be much appreciated.

Best,
Laurin


Regine I. Heberlein

unread,
Aug 15, 2025, 1:35:00 PMAug 15
to Laurin Penland, Archivesspace_Users_Group
I have a fuzzy memory of running into something like that a few years ago, and the workaround was to use the search API rather than the top_containers endpoint. It’s much faster, or at least that was true then. Give it a try? Something like this (we use Ruby):

client.get(
  "repositories/2/top_containers/search",
  query: { q: "collection_uri_u_sstr:\"/repositories/2/resources/26\"" }
)

Regine Heberlein (she/her)

Archival Systems Technical Lead

hebe...@princeton.edu

 

**My working day may not be your working day. Please do not feel obliged to reply to this email outside of your regular working hours.**

 

 

--
You received this message because you are subscribed to the Google Groups "Archivesspace_Users_Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to Archivesspace_User...@lyrasislists.org.
To view this discussion visit https://groups.google.com/a/lyrasislists.org/d/msgid/Archivesspace_Users_Group/d761421e-b530-402b-bfce-313c5c9cfce3n%40lyrasislists.org.

Michael Andrec

unread,
Aug 15, 2025, 4:10:24 PMAug 15
to Archivesspace_Users_Group
The /search endpoint is paginated. I recently wrote some scripting in Python with ArchivesSnake to get all containers at a location across all repositories, and the query was along the lines of

/search?page={page_number}&filter_query[]=primary_type:top_container&filter_query[]=location_uri_u_sstr:"/locations/{location}"

where {page_number} is which page of results you want and {location} is the location ID. I did NOT come up with that on my own. Found it somewhere...

m

On Fri, Aug 15, 2025 at 1:34 PM 'Regine I. Heberlein' via Archivesspace_Users_Group <Archivesspac...@lyrasislists.org> wrote:
I have a fuzzy memory of running into something like that a few years ago, and the workaround was to use the search API rather than the top_containers endpoint.

 
--

Michael Andrec, Ph.D. -- Certified Archivist

Ukrainian History and Education Center
135 Davidson Avenue
Somerset, NJ 08873

m.an...@UkrHEC.org
+1-732-356-0132 (UHEC Director's office)
+1-732-659-0705 (direct line via Google Voice)
17326590705 (Signal)

Laurin Penland

unread,
Aug 19, 2025, 2:06:55 PMAug 19
to Michael Andrec, Archivesspace_Users_Group

Thank you so much, Michael and Regine! I was able to use the search endpoint to get what I needed.

 

Best,
Laurin

 

From: archivesspac...@lyrasislists.org <archivesspac...@lyrasislists.org> on behalf of Michael Andrec <m.an...@ukrhec.org>
Date: Friday, August 15, 2025 at 4:10

PM

--

You received this message because you are subscribed to the Google Groups "Archivesspace_Users_Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to Archivesspace_User...@lyrasislists.org.

Reply all
Reply to author
Forward
0 new messages