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

2020-03-10 Thread Corey Schmidt
You're absolutely correct. I changed my endpoint and it's working wonderfully. 
Thank you so much!

-Original Message-
From: archivesspace_users_group-boun...@lyralists.lyrasis.org 
 On Behalf Of Mayo, 
Dave
Sent: Tuesday, March 10, 2020 9:24 AM
To: Archivesspace Users Group 
Subject: Re: [Archivesspace_Users_Group] Search Across Repositories and Get EAD 
XML - ArchivesSpace API

[EXTERNAL SENDER - PROCEED CAUTIOUSLY]


So, (and sorry I didn't catch this before, I was focused on the narrower 
issues), I think your problem there is actually that you're using the wrong 
endpoint.  When the docs say "Search across repositories," they don't mean 
"Search for arbitrary records across all repositories," they mean "Search 
across all records of TYPE "repository" - so you're getting back nothing 
because there are no resources that are also repositories (

The actual "search for arbitrary things everywhere" URL is just "/search" - I 
think if you use that, you ought to get some results.

--
Dave Mayo (he/him)
Senior Digital Library Software Engineer Harvard University > HUIT > LTS

On 3/10/20, 8:29 AM, "archivesspace_users_group-boun...@lyralists.lyrasis.org 
on behalf of Corey Schmidt" 
 wrote:

This is all great! I've adjusted my search query to use parameters you 
recommended and I'm getting a response back. Though my searches are not 
generating any results. I've tried searching for collection titles and random 
words, but nothing comes back in the results value. Would you have any 
recommendations?

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

I've also adjusted my EAD xml endpoint call and saving the file as you 
recommended and it's working like a charm. It's interesting to note that in 
previous exports, the barcodes to containers were being attached to the "label" 
attribute for the container tag (label="Mixed Materials [5168852364844]"). Yet, 
these exports are generating the "physloc" element with the barcode as the 
value. This works for us, I just thought it was odd.

-Original Message-
From: archivesspace_users_group-boun...@lyralists.lyrasis.org 
 On Behalf Of Mayo, 
Dave
Sent: Monday, March 9, 2020 12:46 PM
    To: Archivesspace Users Group 

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

[EXTERNAL SENDER - PROCEED CAUTIOUSLY]


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_daos=true_cs=true_pdf=false=false')
with open('myfile.xml', 'wb') as f:
file.write(response.content)

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:  on behalf 
of Corey Schmidt 
Reply-To: Archivesspace Users Group 

Date: Monday, March 9, 2020 at 10:39 AM
To: "archivesspace_users_group@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=DwMFAg=WO-RGvefibhHBZq3fL85hQ=_Mv1dY22K7jvT5MD7xjbvGVzRDOUMhx4WYcnPSIzYnE=B2y_0wn1HLyXldJyck05IgPrsrOCn8LyjRI8q5uSbtc=_eqqK2s6KdcWsYV9Ke0loG2mitQ-I_nV-F9VeT24-l0=
 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:

 client.get('search/repositories?type="resource"=ms954_ids=true')
 client.get('/search/repositories?q=ms954="resource"_ids=true')

Second, I want to download an EAD xml file directly from the API using this 
endpoint: 
ht

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

2020-03-10 Thread Mayo, Dave
So, (and sorry I didn't catch this before, I was focused on the narrower 
issues), I think your problem there is actually that you're using the wrong 
endpoint.  When the docs say "Search across repositories," they don't mean 
"Search for arbitrary records across all repositories," they mean "Search 
across all records of TYPE "repository" - so you're getting back nothing 
because there are no resources that are also repositories (

The actual "search for arbitrary things everywhere" URL is just "/search" - I 
think if you use that, you ought to get some results.

--
Dave Mayo (he/him)
Senior Digital Library Software Engineer
Harvard University > HUIT > LTS

On 3/10/20, 8:29 AM, "archivesspace_users_group-boun...@lyralists.lyrasis.org 
on behalf of Corey Schmidt" 
 wrote:

This is all great! I've adjusted my search query to use parameters you 
recommended and I'm getting a response back. Though my searches are not 
generating any results. I've tried searching for collection titles and random 
words, but nothing comes back in the results value. Would you have any 
recommendations?

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

I've also adjusted my EAD xml endpoint call and saving the file as you 
recommended and it's working like a charm. It's interesting to note that in 
previous exports, the barcodes to containers were being attached to the "label" 
attribute for the container tag (label="Mixed Materials [5168852364844]"). Yet, 
these exports are generating the "physloc" element with the barcode as the 
value. This works for us, I just thought it was odd.

-Original Message-
From: archivesspace_users_group-boun...@lyralists.lyrasis.org 
 On Behalf Of Mayo, 
Dave
Sent: Monday, March 9, 2020 12:46 PM
    To: Archivesspace Users Group 

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

[EXTERNAL SENDER - PROCEED CAUTIOUSLY]


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_daos=true_cs=true_pdf=false=false')
with open('myfile.xml', 'wb') as f:
file.write(response.content)

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:  on behalf 
of Corey Schmidt 
Reply-To: Archivesspace Users Group 

Date: Monday, March 9, 2020 at 10:39 AM
To: "archivesspace_users_group@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=DwMFAg=WO-RGvefibhHBZq3fL85hQ=_Mv1dY22K7jvT5MD7xjbvGVzRDOUMhx4WYcnPSIzYnE=B2y_0wn1HLyXldJyck05IgPrsrOCn8LyjRI8q5uSbtc=_eqqK2s6KdcWsYV9Ke0loG2mitQ-I_nV-F9VeT24-l0=
 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:

 client.get('search/repositories?type="resource"=ms954_ids=true')
 client.get('/search/repositories?q=ms954="resource"_ids=true')

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=DwMFAg=WO-RGvefibhHBZq3fL85hQ=_Mv1dY22K7jvT5MD7xjbvGVzRDOUMhx4WYcnPSIzYnE=B2y_0wn1HLyXldJyck05IgPrsrOCn8LyjRI8q5uSbtc=xwd2j6qv-zYs8pDbLpLM23dcSeDYcPUkZSAuio8FEVQ=
 XML. How do I specify where the EAD xml file saves to? I’m not e

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

2020-03-10 Thread Corey Schmidt
We will have to set up our OAI configuration, but haven’t looked into that 
process yet. I will keep this in mind moving forward. Thanks!

From: archivesspace_users_group-boun...@lyralists.lyrasis.org 
 On Behalf Of 
Majewski, Steven Dennis (sdm7g)
Sent: Monday, March 9, 2020 12:43 PM
To: Archivesspace Users Group 
Subject: Re: [Archivesspace_Users_Group] Search Across Repositories and Get EAD 
XML - ArchivesSpace API

[EXTERNAL SENDER - PROCEED CAUTIOUSLY]
I would also add that if you want the EAD, it may be simpler to access it from 
the OAI endpoint, but only if OAI is configured properly. Try downloading a 
resource using oai_ead metadata from the oai/sample page, to see if it’s 
configured properly and what the resource URLs will look like.

— Steve M.




On Mar 9, 2020, at 10:39 AM, Corey Schmidt 
mailto:corey.schm...@uga.edu>> wrote:

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 Search across 
repositories<https://archivesspace.github.io/archivesspace/api/#search-across-repositories>
 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:

 client.get('search/repositories?type="resource"=ms954_ids=true')
 client.get('/search/repositories?q=ms954="resource"_ids=true')

Second, I want to download an EAD xml file directly from the API using this 
endpoint: Get an EAD representation of a 
Resource<https://archivesspace.github.io/archivesspace/api/#get-an-ead-representation-of-a-resource>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_daos=true_cs=true_pdf=false=false')

Any help would be greatly appreciated!

Sincerely,

Corey

Corey Schmidt
ArchivesSpace Project Manager | University of Georgia Libraries
Email: corey.schm...@uga.edu<mailto:corey.schm...@uga.edu>
Phone: +1-706-542-8151

___
Archivesspace_Users_Group mailing list
Archivesspace_Users_Group@lyralists.lyrasis.org<mailto:Archivesspace_Users_Group@lyralists.lyrasis.org>
http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group

___
Archivesspace_Users_Group mailing list
Archivesspace_Users_Group@lyralists.lyrasis.org
http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group


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

2020-03-10 Thread Corey Schmidt
This is all great! I've adjusted my search query to use parameters you 
recommended and I'm getting a response back. Though my searches are not 
generating any results. I've tried searching for collection titles and random 
words, but nothing comes back in the results value. Would you have any 
recommendations?

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

I've also adjusted my EAD xml endpoint call and saving the file as you 
recommended and it's working like a charm. It's interesting to note that in 
previous exports, the barcodes to containers were being attached to the "label" 
attribute for the container tag (label="Mixed Materials [5168852364844]"). Yet, 
these exports are generating the "physloc" element with the barcode as the 
value. This works for us, I just thought it was odd.

-Original Message-
From: archivesspace_users_group-boun...@lyralists.lyrasis.org 
 On Behalf Of Mayo, 
Dave
Sent: Monday, March 9, 2020 12:46 PM
To: Archivesspace Users Group 
Subject: Re: [Archivesspace_Users_Group] Search Across Repositories and Get EAD 
XML - ArchivesSpace API

[EXTERNAL SENDER - PROCEED CAUTIOUSLY]


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_daos=true_cs=true_pdf=false=false')
with open('myfile.xml', 'wb') as f:
file.write(response.content)

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:  on behalf of 
Corey Schmidt 
Reply-To: Archivesspace Users Group 

Date: Monday, March 9, 2020 at 10:39 AM
To: "archivesspace_users_group@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=DwMFAg=WO-RGvefibhHBZq3fL85hQ=_Mv1dY22K7jvT5MD7xjbvGVzRDOUMhx4WYcnPSIzYnE=B2y_0wn1HLyXldJyck05IgPrsrOCn8LyjRI8q5uSbtc=_eqqK2s6KdcWsYV9Ke0loG2mitQ-I_nV-F9VeT24-l0=
 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:

 client.get('search/repositories?type="resource"=ms954_ids=true')
 client.get('/search/repositories?q=ms954="resource"_ids=true')

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=DwMFAg=WO-RGvefibhHBZq3fL85hQ=_Mv1dY22K7jvT5MD7xjbvGVzRDOUMhx4WYcnPSIzYnE=B2y_0wn1HLyXldJyck05IgPrsrOCn8LyjRI8q5uSbtc=xwd2j6qv-zYs8pDbLpLM23dcSeDYcPUkZSAuio8FEVQ=
 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_daos=true_cs=true_pdf=false=false')

Any help would be greatly appreciated!

Sincerely,

Corey

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


___
Archivesspace_Users_Group mailing list
Archivesspace_Users_Group@lyralists.lyrasis.org
http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group
___
Archivesspace_Users_Group mailing list
Archivesspace_Users_Group@lyralists.lyrasis.org
http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group


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

2020-03-09 Thread Mayo, Dave
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_daos=true_cs=true_pdf=false=false')
with open('myfile.xml', 'wb') as f:
file.write(response.content)

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:  on behalf of 
Corey Schmidt 
Reply-To: Archivesspace Users Group 

Date: Monday, March 9, 2020 at 10:39 AM
To: "archivesspace_users_group@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=DwMFAg=WO-RGvefibhHBZq3fL85hQ=_Mv1dY22K7jvT5MD7xjbvGVzRDOUMhx4WYcnPSIzYnE=B2y_0wn1HLyXldJyck05IgPrsrOCn8LyjRI8q5uSbtc=_eqqK2s6KdcWsYV9Ke0loG2mitQ-I_nV-F9VeT24-l0=
 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:

 client.get('search/repositories?type="resource"=ms954_ids=true')
 client.get('/search/repositories?q=ms954="resource"_ids=true')

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=DwMFAg=WO-RGvefibhHBZq3fL85hQ=_Mv1dY22K7jvT5MD7xjbvGVzRDOUMhx4WYcnPSIzYnE=B2y_0wn1HLyXldJyck05IgPrsrOCn8LyjRI8q5uSbtc=xwd2j6qv-zYs8pDbLpLM23dcSeDYcPUkZSAuio8FEVQ=
 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_daos=true_cs=true_pdf=false=false')

Any help would be greatly appreciated!

Sincerely,

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

___
Archivesspace_Users_Group mailing list
Archivesspace_Users_Group@lyralists.lyrasis.org
http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group


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

2020-03-09 Thread Majewski, Steven Dennis (sdm7g)
I would also add that if you want the EAD, it may be simpler to access it from 
the OAI endpoint, but only if OAI is configured properly. Try downloading a 
resource using oai_ead metadata from the oai/sample page, to see if it’s 
configured properly and what the resource URLs will look like. 

— Steve M.



> On Mar 9, 2020, at 10:39 AM, Corey Schmidt  wrote:
> 
> 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 Search across repositories 
> 
>  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:
> 
>  client.get('search/repositories?type="resource"=ms954_ids=true')
>  client.get('/search/repositories?q=ms954="resource"_ids=true')
> 
> Second, I want to download an EAD xml file directly from the API using this 
> endpoint: Get an EAD representation of a Resource 
> 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_daos=true_cs=true_pdf=false=false')
> 
> Any help would be greatly appreciated!
> 
> Sincerely,
> 
> Corey
>  
> Corey Schmidt
> ArchivesSpace Project Manager | University of Georgia Libraries
> Email: corey.schm...@uga.edu 
> Phone: +1-706-542-8151
>  
> ___
> Archivesspace_Users_Group mailing list
> Archivesspace_Users_Group@lyralists.lyrasis.org 
> 
> http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group 
> 


smime.p7s
Description: S/MIME cryptographic signature
___
Archivesspace_Users_Group mailing list
Archivesspace_Users_Group@lyralists.lyrasis.org
http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group


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

2020-03-09 Thread Mayo, Dave
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:

search/repositories?type[]="resource"=ms945=1

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:

https://github.com/archivesspace-labs/archivessnake#low-level-api
https://requests.readthedocs.io/en/master/user/quickstart/#passing-parameters-in-urls

--
Dave Mayo (he/him)
Senior Digital Library Software Engineer
Harvard University > HUIT > LTS

From:  on behalf of 
Corey Schmidt 
Reply-To: Archivesspace Users Group 

Date: Monday, March 9, 2020 at 10:39 AM
To: "archivesspace_users_group@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=DwMFAg=WO-RGvefibhHBZq3fL85hQ=_Mv1dY22K7jvT5MD7xjbvGVzRDOUMhx4WYcnPSIzYnE=B2y_0wn1HLyXldJyck05IgPrsrOCn8LyjRI8q5uSbtc=_eqqK2s6KdcWsYV9Ke0loG2mitQ-I_nV-F9VeT24-l0=
 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:

 client.get('search/repositories?type="resource"=ms954_ids=true')
 client.get('/search/repositories?q=ms954="resource"_ids=true')

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=DwMFAg=WO-RGvefibhHBZq3fL85hQ=_Mv1dY22K7jvT5MD7xjbvGVzRDOUMhx4WYcnPSIzYnE=B2y_0wn1HLyXldJyck05IgPrsrOCn8LyjRI8q5uSbtc=xwd2j6qv-zYs8pDbLpLM23dcSeDYcPUkZSAuio8FEVQ=
 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_daos=true_cs=true_pdf=false=false')

Any help would be greatly appreciated!

Sincerely,

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

___
Archivesspace_Users_Group mailing list
Archivesspace_Users_Group@lyralists.lyrasis.org
http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group