[Archivesspace_Users_Group] limiting API search query to specific record types

Donald Mennerich don.mennerich at nyu.edu
Thu Nov 10 07:50:15 EST 2016


Thanks James, that did it

just for reference:

> client.get('repositories/3/search?type[]=resource&page=1&aq={"query":{"field":"title","value":"'
> + q + '", "jsonmodel_type":"field_query","negated":false,"literal":true}}')


Donald R. Mennerich, digital archivist
New York University Libraries
don.mennerich at nyu.edu (212) 992-6264


On Wed, Nov 9, 2016 at 4:55 PM, James Bullen <james at hudmol.com> wrote:

>
> Hi Don,
>
> Try this:
> type[]=resource
>
>
> Cheers,
> James
>
>
>
> On Nov 10, 2016, at 5:44 AM, Valerie Addonizio <vaddoniz at jhu.edu> wrote:
>
> Hmm, another suggestion from a colleague is to remove the brackets around
> resource:
>
> response = client.get('repositories/3/search?page=1&aq={"query":{"field":"title","value":"Jeremy
> Blake Papers", "jsonmodel_type":"field_query","negated":false,"literal":true,
> "type": "resource" }}')
>
>
> *From:* archivesspace_users_group-bounces at lyralists.lyrasis.org [mailto:
> archivesspace_users_group-bounces at lyralists.lyrasis.org
> <archivesspace_users_group-bounces at lyralists.lyrasis.org>] *On Behalf Of *Donald
> Mennerich
> *Sent:* Wednesday, November 09, 2016 12:05 PM
> *To:* Archivesspace Users Group
> *Subject:* Re: [Archivesspace_Users_Group] limiting API search query to
> specific record types
>
> Thanks,
>
> Thanks, I did try that. The resources endpoint is expecting an :id, and
> the api returns: {"error"=>{"id"=>["Wanted type Integer but got
> 'search'"]}}
>
> Don
>
> On Wed, Nov 9, 2016 at 11:53 AM, Valerie Addonizio <vaddoniz at jhu.edu>
> wrote:
> This is only a guess, but including the endpoint for Resource may do it,
> here, in your string:
>
> repositories/3/resources/
>
> *From:* archivesspace_users_group-bounces at lyralists.lyrasis.org [mailto:
> archivesspace_users_group-bounces at lyralists.lyrasis.org] *On Behalf Of *Donald
> Mennerich
> *Sent:* Wednesday, November 09, 2016 11:43 AM
> *To:* archivesspace_users_group at lyralists.lyrasis.org
> *Subject:* [Archivesspace_Users_Group] limiting API search query to
> specific record types
>
> AUG:
>
> I am trying to get resource records from the ASpace API, I'm currently
> using the advanced query example that Chris had posted in 2015.
>
> response = client.get('repositories/3/search?page=1&aq={"query":{"field":"title","value":"Jeremy
> Blake Papers", "jsonmodel_type":"field_query","negated":false,"literal":
> true}}')
>
> While this returns the wanted resource record, the api also returns an
> accession record and a collection control management. So my question: how
> can I filter to just resource records? I see in the json for any record has
> a field to  "type"=>["resource"], and there's documentation in the API
> about using this field in an advanced query:
>
>
> [String] type – The record type to search (defaults to all types if not
> specified)
>
>
> I've tried adding a "type" parameter to a query in numerous ways, such as:
>
> response = client.get('repositories/3/search?page=1&aq={"query":{"field":"title","value":"Jeremy
> Blake Papers", "jsonmodel_type":"field_query","negated":false,"literal":
> true, *"type": ["resource"] *}}')
>
>
> Can anyone provide some guidance on how to limit results from the search
> API to specific record types?
>
> Thanks.
>
> Don
>
>
>
> _______________________________________________
> Archivesspace_Users_Group mailing list
> Archivesspace_Users_Group at lyralists.lyrasis.org
> http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group
>
> !DSPAM:58236ea1294121893667704! ___________________________________
> ____________
> Archivesspace_Users_Group mailing list
> Archivesspace_Users_Group at lyralists.lyrasis.org
> http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group
>
>
> !DSPAM:58236ea1294121893667704!
>
>
>
> _______________________________________________
> Archivesspace_Users_Group mailing list
> Archivesspace_Users_Group at lyralists.lyrasis.org
> http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/attachments/20161110/c9bcfdfc/attachment.html>


More information about the Archivesspace_Users_Group mailing list