<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><br class=""></div>Hi again Tommy,<div class=""><br class=""></div><div class="">It looks like this ends up at this line:</div><div class=""><a href="https://github.com/archivesspace/archivesspace/blob/master/backend/app/model/mixins/tree_nodes.rb#L63" class="">https://github.com/archivesspace/archivesspace/blob/master/backend/app/model/mixins/tree_nodes.rb#L63</a></div><div class=""><br class=""></div><div class="">Where, if you give it a large value for position (ie more than the maximum number of siblings you would expect in your data) it will end up being the last in the list.</div><div class=""><br class=""></div><div class="">It wouldn’t be too much work for someone to honor the optional position declaration in the endpoint and trace it down to here where it would default to siblings_count - 1. That is, if you don’t specify a position it gets added to the end - seems like a reasonable default behavior.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Cheers,</div><div class="">James</div><div class=""><br class=""></div><div class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Aug 25, 2021, at 2:02 AM, Keswick, Thomas (Tommy) <<a href="mailto:tkeswick@caltech.edu" class="">tkeswick@caltech.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" class="">

<div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Thanks, James. Adding the position parameter does seem to work.
<div class=""><br class="">
</div>
<div class="">Does anyone know of a way to add an item to the end of the children list without having to count the number of existing children? Using -1 (negative one) does not work as “Offsets must be greater than or equal to 0”.</div>
<div class=""><br class="">
</div>
<div class="">Cheers,</div>
<div class="">Tommy<br class="">
<div class=""><br class="">
<blockquote type="cite" class="">
<div class="">On Aug 23, 2021, at 5:46 PM, James Bullen <<a href="mailto:james@hudmol.com" class="">james@hudmol.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<div class=""><br class="">
</div>
Hi Tommy,
<div class=""><br class="">
</div>
<div class="">I’m ready to be wrong on this, but just had a quick look and it seems like the position param is required even though the endpoint declares it as optional.</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">Cheers,</div>
<div class="">James</div>
<div class=""><br class="">
<div class=""><br class="">
<blockquote type="cite" class="">
<div class="">On Aug 24, 2021, at 9:30 AM, Keswick, Thomas (Tommy) <<a href="mailto:tkeswick@caltech.edu" class="">tkeswick@caltech.edu</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Greetings.
<div class=""><br class="">
</div>
<div class="">I’m trying to use the <a href="https://archivesspace.github.io/archivesspace/api/#set-the-parent-position-of-an-archival-object-in-a-tree" class="">Set the parent/position of an Archival Object in a tree</a> API endpoint but I am getting an error
 when I supply both the archival object ID and the parent ID in what should be the correct way. The Archival Object is an item-level record and the parent is a series-level record, both under the same Resource.</div>
<div class=""><br class="">
</div>
<div class="">The error is:</div>
<div class="">
<div class="">{</div>
<div class="">    "error": "comparison of Integer with nil failed"</div>
<div class="">}</div>
</div>
<div class=""><br class="">
</div>
<div class="">Here is some sample Python code that fails:</div>
<div class="">```</div>
<div class="">
<div class="">import json</div>
<div class=""><br class="">
</div>
<div class="">from asnake.client import ASnakeClient</div>
<div class=""><br class="">
</div>
<div class="">asnake_client = ASnakeClient()</div>
<div class="">asnake_client.authorize()</div>
<div class=""><br class="">
</div>
<div class="">parent_post_response = asnake_client.post(</div>
<div class="">    "/repositories/2/archival_objects/96413/parent?parent=96414"</div>
<div class="">)</div>
<div class="">print(json.dumps(parent_post_response.json(), sort_keys=True, indent=4))</div>
</div>
<div class="">```</div>
<div class=""><br class="">
</div>
<div class="">The locally installed ArchivesSpace version that I am testing on is 2.8.1 currently.</div>
<div class=""><br class="">
</div>
<div class="">Thanks for any help.</div>
<div class=""><br class="">
</div>
<div class="">Cheers,</div>
<div class="">Tommy</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</blockquote>
<br class="">
</div>
</div>
</div>

_______________________________________________<br class="">Archivesspace_Users_Group mailing list<br class=""><a href="mailto:Archivesspace_Users_Group@lyralists.lyrasis.org" class="">Archivesspace_Users_Group@lyralists.lyrasis.org</a><br class="">http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group<br class=""></div></blockquote></div><br class=""></div></body></html>