<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
        {font-family:Georgia;
        panose-1:2 4 5 2 5 4 5 2 3 3;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Consolas",serif;}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Hi Corey! <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Sorry for taking so long to get back to you!<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The reason you’ve had no success is that, frankly, this aspect of the app’s functionality is bad? Bad, it is poorly implemented in a way that makes it basically impossible to suss out without reading the code.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">What this function actually expects is: an array of strings with serialized JSON, each of which contains a JSON array of a four part id, null trailing components of which can be omitted.<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Here’s a working example for two records from Harvard:<br>
<br>
x.client.get('repositories/3/find_by_id/resources', params={'identifier[]': ['["ecb00051",null,null,null]', '["bf-test"]']}).json()<br>
<br>
This returns:<br>
<br>
{'resources': [{'ref': '/repositories/3/resources/7303'},<o:p></o:p></p>
<p class="MsoNormal">  {'ref': '/repositories/3/resources/9611'}]}<br>
<br>
So, a working version of your query would be:<br>
<br>
find_res_id = client.get(‘repositories/2/find_by_id/resources’, params={‘identifier’: [‘[“test”, “1234”, “abcd”, “!@#$”]’]})<br>
<br>
Or less hatefully? Maybe?<br>
<br>
import json<br>
find_res_id = client.get(‘repositories/2/find_by_id/resources’, params={‘identifier’: [json.dumps([‘test’, ‘1234’, ‘abcd’, ‘!@#$’])]})<o:p></o:p></p>
<p class="MsoNormal"><br>
In any event, it’s a weird way to do business and I don’t care for it.<br>
<br>
<o:p></o:p></p>
<p class="MsoNormal">--<o:p></o:p></p>
<p class="MsoNormal">Dave Mayo (he/him)<o:p></o:p></p>
</div>
<p class="MsoNormal">Senior Digital Library Software Engineer<br>
Harvard University > HUIT > LTS<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:12.0pt;color:black">From: </span></b><span style="font-size:12.0pt;color:black"><archivesspace_api_doc_adhoc-bounces@lyralists.lyrasis.org> on behalf of Corey Schmidt <Corey.Schmidt@uga.edu><br>
<b>Reply-To: </b>"archivesspace_api_doc_adhoc@lyralists.lyrasis.org" <archivesspace_api_doc_adhoc@lyralists.lyrasis.org><br>
<b>Date: </b>Wednesday, March 23, 2022 at 4:23 PM<br>
<b>To: </b>"archivesspace_api_doc_adhoc@lyralists.lyrasis.org" <archivesspace_api_doc_adhoc@lyralists.lyrasis.org><br>
<b>Subject: </b>[Archivesspace_api_doc_adhoc] find_by_id Endpoint Help<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">Dear all,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black"><br>
Hello, this is Corey Schmidt from the University of Georgia. I hope everyone is well and enjoying the slow warmup to Spring.<br>
<br>
I've been hitting some roadblocks trying to write documentation for API endpoints and I wanted to askfor your help. For the
<a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__archivesspace.github.io_archivesspace_api_-3Fshell-23find-2Dresources-2Dby-2Dtheir-2Didentifiers&d=DwMFAw&c=WO-RGvefibhHBZq3fL85hQ&r=_Mv1dY22K7jvT5MD7xjbvGVzRDOUMhx4WYcnPSIzYnE&m=C2RTpp6a036fpnD59EANxOYTWgp62F2fxW6SOcn7HPqjzSghIQN4KWW5_v9UYUJR&s=jI_tQ6Z_E7reBBJrWf2gLSIXIMZoFQN7jLH3NgzihxQ&e=" title="https://archivesspace.github.io/archivesspace/api/?shell#find-resources-by-their-identifiers">
find_by_id resource endpoint</a>, I'm trying to find a resource with a four-part ID, but when I call the endpoint, it keeps giving me an error I can't pin down. Here's what I'm calling:
<o:p></o:p></span></p>
<div>
<pre style="background:#2B2B2B"><span style="color:#CC7832">from </span><span style="color:#A9B7C6">asnake.client </span><span style="color:#CC7832">import </span><span style="color:#A9B7C6">ASnakeClient<br></span><span style="color:#CC7832">import </span><span style="color:#A9B7C6">asnake.logging </span><span style="color:#CC7832">as </span><span style="color:#A9B7C6">loggin<o:p></o:p></span></pre>
<pre style="background:#2B2B2B"><span style="color:#A9B7C6">client = ASnakeClient(</span><span style="color:#AA4926">baseurl</span><span style="color:#A9B7C6">=as_api</span><span style="color:#CC7832">, </span><span style="color:#AA4926">username</span><span style="color:#A9B7C6">=as_un</span><span style="color:#CC7832">, </span><span style="color:#AA4926">password</span><span style="color:#A9B7C6">=as_pw)<br>client.authorize()</span><span style="color:gray"><br><br></span><span style="color:#A9B7C6">find_res_id = client.get(</span><span style="color:#6A8759">'repositories/2/find_by_id/resources'</span><span style="color:#CC7832">, </span><span style="color:#AA4926">params</span><span style="color:#A9B7C6">={</span><span style="color:#6A8759">'identifier[]'</span><span style="color:#A9B7C6">: [</span><span style="color:#6A8759">'test'</span><span style="color:#CC7832">, </span><span style="color:#6A8759">'1234'</span><span style="color:#CC7832">, </span><span style="color:#6A8759">'abcd'</span><span style="color:#CC7832">, </span><span style="color:#6A8759">'!@#$'</span><span style="color:#A9B7C6">]})<br></span><span style="color:#8888C6">print</span><span style="color:#A9B7C6">(find_res_id.json()</span><span style="color:#CC7832">, </span><span style="color:#A9B7C6">find_res_id)<o:p></o:p></span></pre>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">Here's the error message:<o:p></o:p></span></p>
</div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">{'error': "Had some trouble parsing your request: unexpected token at 'test'"} <Response [400]><br>
<br>
It may be an issue with the requests package, but I'm not sure. I tested both ASnake and requests, and they gave the same error.<br>
<br>
Any help/advice would be appreciated, thanks!<br>
<br>
Corey<o:p></o:p></span></p>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div id="Signature">
<div>
<div>
<p style="background:white"><b><span style="font-size:9.0pt;font-family:"Georgia",serif;color:black">Corey Schmidt</span></b><span style="font-size:9.0pt;font-family:"Georgia",serif;color:black">
<br>
Special Collections Libraries | <i>ArchivesSpace Project Manager</i><o:p></o:p></span></p>
<p style="background:white"><span style="font-size:9.0pt;font-family:"Georgia",serif;color:black"><o:p> </o:p></span></p>
<p style="background:white"><span style="font-size:9.0pt;font-family:"Georgia",serif;color:black"><a href="tel:7065428151">706-542-8151</a> |
<a href="mailto:Corey.Schmidt@uga.edu">Corey.Schmidt@uga.edu</a><o:p></o:p></span></p>
<p style="background:white"><span style="font-size:9.0pt;font-family:"Georgia",serif;color:black"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black"><img border="0" width="160" style="width:1.6666in" id="_x0000_i1025" src="https://brand.uga.edu/email-signature-builder/assets/images/uga-logo@2x.png" alt="University of Georgia"><o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>