<div dir="ltr"><div>Hi Karen,</div><div><br></div><div>To be a little more specific, I'm getting the sense (since I've struggled with needing to update some notes but not others as well) that what you're asking is how to create the path to a specific note when you don't know in advance which note it's going to be. <br></div><div><br></div><div>If you want to only modify notes that have html tags in them, you'll need to give it the path to ['notes'] part of the structure, and then run a for-loop, since that part is a list. You can ask it to look at each note in the list of notes and only make changes if it comes across one of the bad tags you're looking for. In python this would look something like <br></div><div><br></div><div>for note in json['notes']</div><div> if 'bad tag' in note:</div><div> modify the note<br></div><div><br></div><div>I'm afraid that I am enough of a scripter to only use Python to interact with the API, if you're using Postman or anything like that I'm not entirely sure how you'd accomplish something like this, and maybe somebody else can advise.<br></div><div><br></div><div>The thing that was hardest for me about learning how to interact with JSON was coming to realize that as far as the scripting language is concerned, anything inside square brackets [ ] is a list, and anything inside curly braces { } is a dictionary, and they can be interacted with as those data types. <br></div><div><br></div><div>Hope that helps, and sorry if I misread what your problem was!</div><div>Chris<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jun 30, 2020 at 7:35 PM James Bullen <<a href="mailto:james@hudmol.com">james@hudmol.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;"><div><br></div>Hi Karen,<div><br></div><div>The general rule is that anything you can GET from a uri can be modified and POSTed back to update it.</div><div><br></div><div>So, GET the JSON for the archival_object as you are doing. Then modify the JSON (in this case the notes bit of it) to look how you want. Then POST it back to the same uri.</div><div><br></div><div>Notes are nested subrecords (as are dates and others). These don’t have a life of their own, they are really just repeating parts of the top level record that they are contained within.</div><div><br></div><div>Hope that helps..</div><div><br></div><div><br></div><div>Cheers,</div><div>James</div><div><br><div><br><blockquote type="cite"><div>On Jul 1, 2020, at 8:22 AM, Karen Miller <<a href="mailto:k-miller3@northwestern.edu" target="_blank">k-miller3@northwestern.edu</a>> wrote:</div><br><div><div style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt;font-family:Arial,sans-serif;color:rgb(31,73,125)">Good morning, ArchivesSpace users.<u></u><u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt;font-family:Arial,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt;font-family:Arial,sans-serif;color:rgb(31,73,125)">I am a cataloger (*not* a developer) using the API to update ArchivesSpace. So far I’ve figured out how to add LCCNs to the authority_Id of Agent records and do a couple more updates that, in retrospect, were pretty simple.<span> </span><u></u><u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt;font-family:Arial,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt;font-family:Arial,sans-serif;color:rgb(31,73,125)">The next task I’d like to tackle, however, just seems like maybe it can’t be done. We’ve got a lot of notes with html tags in them and I would like to update those to valid tags. I can get the JSON for the notes in any particular archival object, but I don’t know how to specify the route to the note to change it. The JSON looks like this:<u></u><u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt;font-family:Arial,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt">'notes': [{'content': ['This is a note with a bad <i>tag</i>'],<u></u><u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt"> 'jsonmodel_type': 'note_singlepart',<u></u><u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt"> 'persistent_id': '75ba0ec57e374b8b154551a69b4c311f',<u></u><u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt"> 'publish': True,<u></u><u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt"> 'type': 'abstract'},<u></u><u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt"> {'jsonmodel_type': 'note_multipart',<u></u><u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt"> 'persistent_id': '66afa07b3214260078123236bbe1ff27',<u></u><u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt"> 'publish': True,<u></u><u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt"> 'subnotes': [{'content': 'This is a dippy note.',<u></u><u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt"> 'jsonmodel_type': 'note_text',<u></u><u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt"> 'publish': True}],<u></u><u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt"> 'type': 'scopecontent'}],<u></u><u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt;font-family:Arial,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt;font-family:Arial,sans-serif;color:rgb(31,73,125)">I got this using the route ‘repositories/10/archival_objects/489763’, but I don’t know how to specify the note that I want in the JSON. For the agent authority_id I used the route ‘‘/agents/people/<somenumber> and specified the field like this:<u></u><u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt;font-family:Arial,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif;text-indent:0.5in"><span style="font-size:12pt;font-family:Arial,sans-serif;color:rgb(31,73,125)">['names'][0]['authority_id']<u></u><u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt;font-family:Arial,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt;font-family:Arial,sans-serif;color:rgb(31,73,125)">I’m hoping this is an easy question for somebody with more experience with the API and (especially) with JSON than I. I’m a little afraid the answer is that it can’t be done. Any advice will be appreciated!<span> </span><u></u><u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt;font-family:Arial,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt;font-family:Arial,sans-serif;color:rgb(31,73,125)">Karen<u></u><u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt;font-family:Arial,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><b><span style="font-family:Arial,sans-serif;color:rgb(39,35,35)">Karen D. Miller<u></u><u></u></span></b></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-family:Arial,sans-serif">Monographic Cataloger/Metadata Specialist<u></u><u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-family:Arial,sans-serif;color:rgb(39,35,35)">Northwestern University Libraries<u></u><u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-family:Arial,sans-serif;color:rgb(78,42,133)">Northwestern University<u></u><u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-family:Arial,sans-serif">1970 Campus Drive<u></u><u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-family:Arial,sans-serif">Evanston, IL 60208<u></u><u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-family:Arial,sans-serif;color:rgb(39,35,35)"><a href="http://www.library.northwestern.edu/" style="color:rgb(149,79,114);text-decoration:underline" target="_blank">www.library.northwestern.edu</a><u></u><u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-family:Arial,sans-serif"><a href="mailto:k-miller3@northwestern.edu" style="color:rgb(149,79,114);text-decoration:underline" target="_blank">k-miller3@northwestern.edu</a><u></u><u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-family:Arial,sans-serif;color:rgb(39,35,35)">874.467.3462</span><span style="color:rgb(31,73,125)"><u></u><u></u></span></div><div style="margin:0in 0in 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div></div><span style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;float:none;display:inline">_______________________________________________</span><br style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><span style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;float:none;display:inline">Archivesspace_Users_Group mailing list</span><br style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><a href="mailto:Archivesspace_Users_Group@lyralists.lyrasis.org" style="color:rgb(149,79,114);text-decoration:underline;font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">Archivesspace_Users_Group@lyralists.lyrasis.org</a><br style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none"><a href="http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group" style="color:rgb(149,79,114);text-decoration:underline;font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group</a></div></blockquote></div><br></div></div>_______________________________________________<br>
Archivesspace_Users_Group mailing list<br>
<a href="mailto:Archivesspace_Users_Group@lyralists.lyrasis.org" target="_blank">Archivesspace_Users_Group@lyralists.lyrasis.org</a><br>
<a href="http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group" rel="noreferrer" target="_blank">http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group</a><br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><div><div><div><span><font color="#888888">Chris Mayo<br></font></span></div><span><font color="#888888">Digital Production Librarian<br></font></span></div><span><font color="#888888"></font></span></div><span><font color="#888888">Boston College<br></font></span></div><span></span></div><span><font color="#888888"><a href="mailto:chris.mayo@bc.edu" target="_blank">chris.mayo@bc.edu</a><br></font></span></div><div><span><font color="#888888">pronouns: they/them/theirs<br></font></span></div></div></div></div></div></div></div></div></div></div></div></div>