[Archivesspace_Users_Group] help with API route for archival object notes

Karen Miller k-miller3 at northwestern.edu
Thu Jul 2 10:30:46 EDT 2020


Thank you, Noah! The Python script looks like it’s exactly what I need. And I appreciate the SQL as well; one less thing for me to code! I think I have just enough Python skills now (i.e., almost none + a reference manual) to make your script work.

Although I really miss cataloging print materials during the pandemic, I am really pleased to be able to learn a new skill while working from home. And I couldn’t have done it without examples, encouragement, and help from the ArchivesSpace community. Thank you!

Karen

From: archivesspace_users_group-bounces at lyralists.lyrasis.org <archivesspace_users_group-bounces at lyralists.lyrasis.org> On Behalf Of Noah Huffman
Sent: Wednesday, July 01, 2020 10:59 AM
To: Archivesspace Users Group <archivesspace_users_group at lyralists.lyrasis.org>
Subject: Re: [Archivesspace_Users_Group] help with API route for archival object notes

Hi Karen,

I believe each note has a persistent identifier, so if you can use SQL to get the note identifiers you can address the problem notes that way.

Here’s an example of some SQL that gets access restriction notes on archival objects including the identifiers: https://github.com/duke-libraries/archivesspace-duke-scripts/blob/master/sql/access_restriction_notes_on_aos.sql<https://urldefense.com/v3/__https:/github.com/duke-libraries/archivesspace-duke-scripts/blob/master/sql/access_restriction_notes_on_aos.sql__;!!Dq0X2DkFhyF93HkjWTBQKhk!FQsO9PqU3enTLZX0T0GRys84svUYZFwVvM8fWXHDtN3ecL--n7iU_fCRmT1ijs0J-9wvs1Gh$>

And, here’s an example of a python script that uses those note identifiers to make updates to those notes (based on a script I borrowed from Alicia Detelich at Yale): https://github.com/duke-libraries/archivesspace-duke-scripts/blob/master/python/duke_as_replace_notes.py#L40<https://urldefense.com/v3/__https:/github.com/duke-libraries/archivesspace-duke-scripts/blob/master/python/duke_as_replace_notes.py*L40__;Iw!!Dq0X2DkFhyF93HkjWTBQKhk!FQsO9PqU3enTLZX0T0GRys84svUYZFwVvM8fWXHDtN3ecL--n7iU_fCRmT1ijs0J-4ZP_r0M$>

I haven’t used these in a while, so I can’t confirm if they still work, but the general idea should still hold.

-Noah

================
Noah Huffman
Archivist for Metadata, Systems, and Digital Records
David M. Rubenstein Rare Book & Manuscript Library
Duke University | 919-660-5982
http://library.duke.edu/rubenstein/<https://urldefense.com/v3/__http:/library.duke.edu/rubenstein/__;!!Dq0X2DkFhyF93HkjWTBQKhk!FQsO9PqU3enTLZX0T0GRys84svUYZFwVvM8fWXHDtN3ecL--n7iU_fCRmT1ijs0J-y9UnFC3$>
Pronouns: he / him / his



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<mailto:archivesspace_users_group-bounces at lyralists.lyrasis.org>> On Behalf Of Karen Miller
Sent: Wednesday, July 1, 2020 11:23 AM
To: Archivesspace Users Group <archivesspace_users_group at lyralists.lyrasis.org<mailto:archivesspace_users_group at lyralists.lyrasis.org>>
Subject: Re: [Archivesspace_Users_Group] help with API route for archival object notes

Hello, James.

Sorry, I just realized I addressed you as Chris instead of as James! My apologies! I was so thrilled to get some assistance that I skimmed through the signatures too quickly.

Best,
Karen

From: Karen Miller
Sent: Wednesday, July 01, 2020 9:50 AM
To: 'Archivesspace Users Group' <archivesspace_users_group at lyralists.lyrasis.org<mailto:archivesspace_users_group at lyralists.lyrasis.org>>
Subject: RE: [Archivesspace_Users_Group] help with API route for archival object notes

Hi Chris.

I’ve been able to successfully retrieve & update nested elements from the Agent record, just not from the archival object notes record. But your description of them as “repeating parts” of that record is helpful. Thanks!

Karen

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<mailto:archivesspace_users_group-bounces at lyralists.lyrasis.org>> On Behalf Of James Bullen
Sent: Tuesday, June 30, 2020 6:35 PM
To: Archivesspace Users Group <archivesspace_users_group at lyralists.lyrasis.org<mailto:archivesspace_users_group at lyralists.lyrasis.org>>
Subject: Re: [Archivesspace_Users_Group] help with API route for archival object notes


Hi Karen,

The general rule is that anything you can GET from a uri can be modified and POSTed back to update it.

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.

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.

Hope that helps..


Cheers,
James


On Jul 1, 2020, at 8:22 AM, Karen Miller <k-miller3 at northwestern.edu<mailto:k-miller3 at northwestern.edu>> wrote:

Good morning, ArchivesSpace users.

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.

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:

'notes': [{'content': ['This is a note with a bad <i>tag</i>'],
            'jsonmodel_type': 'note_singlepart',
            'persistent_id': '75ba0ec57e374b8b154551a69b4c311f',
            'publish': True,
            'type': 'abstract'},
           {'jsonmodel_type': 'note_multipart',
            'persistent_id': '66afa07b3214260078123236bbe1ff27',
            'publish': True,
            'subnotes': [{'content': 'This is a dippy note.',
                          'jsonmodel_type': 'note_text',
                          'publish': True}],
            'type': 'scopecontent'}],

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:

['names'][0]['authority_id']

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!

Karen

Karen D. Miller
Monographic Cataloger/Metadata Specialist
Northwestern University Libraries
Northwestern University
1970 Campus Drive
Evanston, IL 60208
www.library.northwestern.edu<https://urldefense.com/v3/__http:/www.library.northwestern.edu/__;!!OToaGQ!8IIbipACnqRUJks2uPhVE7vqfZ4d0uZnbwOxTX-Vs0LufggwluL4usl1LbpOAe_SktTV$>
k-miller3 at northwestern.edu<mailto:k-miller3 at northwestern.edu>
874.467.3462

_______________________________________________
Archivesspace_Users_Group mailing list
Archivesspace_Users_Group at lyralists.lyrasis.org<mailto:Archivesspace_Users_Group at lyralists.lyrasis.org>
http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group<https://urldefense.com/v3/__http:/lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group__;!!Dq0X2DkFhyF93HkjWTBQKhk!H-EUJhiBG0Tz5NQSebTYw6EUuEtRZ7cUmR2Pz_3UWKMEJCVchzyYC019ApoGsVbid0MZ-UMN$>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/attachments/20200702/718107d4/attachment.html>


More information about the Archivesspace_Users_Group mailing list