[Archivesspace_Users_Group] Need help with API advanced query

Andy Boze boze.1 at nd.edu
Thu May 28 03:20:14 EDT 2020


Dear all,

I'm using curl from the Windows 10 command line to retrieve JSON data 
from our instance of AS. For the most part it's working well. I followed 
some of the discussion from a few months ago which was very helpful in 
figuring out how to use the advanced query, but I've reached a point 
where I'm stuck.

I can successfully send a query with the following string to get a 
record for a resource with the identifier "ABC". I've formatted it here 
so it's easier to read.

{
	"query": {
		"op": "AND",
		"subqueries": [
			{
				"field": "primary_type",
				"value": "resource",
				"comparator": "equals",
				"jsonmodel_type": "field_query"
			},
			{
				"field": "identifier",
				"value": "ABC",
				"comparator": "equals",
				"jsonmodel_type": "field_query"
			}
		],
		"jsonmodel_type": "boolean_query"
	},
	"jsonmodel_type": "advanced_query"
}

What I'm trying to do is get a record for a top_container with a barcode 
of BC98765 by sending a query with this string.

{
	"query": {
		"op": "AND",
		"subqueries": [
			{
				"field": "jsonmodel_type",
				"value": "top_container",
				"comparator": "equals",
				"jsonmodel_type": "field_query"
			},
			{
				"field": "barcode",
				"value": "BC98765",
				"comparator": "equals",
				"jsonmodel_type": "field_query"
			}
		],
		"jsonmodel_type": "boolean_query"
	},
	"jsonmodel_type": "advanced_query"
}

When I send the above query, I get no response, not even an error 
message. I'm thinking jsonmodel_type is not a field that I should query, 
but when I requested the specific top_container record 
(/repositories/2/top_containers/56484) there was no other field with a 
value of top_container.

I'd appreciate any advice how to request a record for a top_container by 
barcode.

Thanks.

Andy

-- 
Andy Boze, Associate Librarian
University of Notre Dame
271H Hesburgh Library
(574) 631-8708


More information about the Archivesspace_Users_Group mailing list