[Archivesspace_Users_Group] partially update a record through API
Steven Majewski
sdm7g at virginia.edu
Tue Nov 25 12:04:31 EST 2014
jq would be handy here:
http://stedolan.github.io/jq/
something like:
GET some object with curl | jq edit | PUT same object with curl
where you pass in object URI and jq edit command.
It would only work for objects where there was a symmetrical GET & PUT.
( i.e. not for GET /repositories/$REPO/resources/$ID )
— Steve.
On Nov 25, 2014, at 10:06 AM, Kevin Clair <Kevin.Clair at du.edu> wrote:
> Hello,
>
> I'd be interested as well. I've written one already, which I can share if there's interest, but it's written for very specific migration tasks that we have here at DU so it might not be the most efficient way of going about this. -k
>
> -----Original Message-----
> From: archivesspace_users_group-bounces at lyralists.lyrasis.org [mailto:archivesspace_users_group-bounces at lyralists.lyrasis.org] On Behalf Of Noah Huffman
> Sent: Tuesday, November 25, 2014 7:27 AM
> To: Archivesspace Users Group
> Subject: Re: [Archivesspace_Users_Group] partially update a record through API
>
> Hi Chris,
>
> If you write this script, could you share with the list? I'd be interested as well.
>
> I expect that these sorts of batch editing tasks will be fairly common.
>
> Thanks,
> -Noah
>
> ================
> Noah Huffman
> Archivist for Metadata and Encoding
> David M. Rubenstein Rare Book & Manuscript Library Duke University http://library.duke.edu/rubenstein/
>
>
>
> -----Original Message-----
> From: archivesspace_users_group-bounces at lyralists.lyrasis.org [mailto:archivesspace_users_group-bounces at lyralists.lyrasis.org] On Behalf Of Chris Fitzpatrick
> Sent: Tuesday, November 25, 2014 8:59 AM
> To: archivesspace_users_group at lyralists.lyrasis.org
> Subject: Re: [Archivesspace_Users_Group] partially update a record through API
>
>
> Hi Mang Sun,
>
>
> If you're doing it this way, you'll need to get the JSON first and add the publish: false value, then POST that back.
>
> I can write a small script for you that does this, if you're interested...
> b,chris
>
> Chris Fitzpatrick | Developer, ArchivesSpace
> Skype: chrisfitzpat | Phone: 918.236.6048 http://archivesspace.org/
>
> ________________________________________
> From: archivesspace_users_group-bounces at lyralists.lyrasis.org <archivesspace_users_group-bounces at lyralists.lyrasis.org> on behalf of Mang Sun <mang.sun at rice.edu>
> Sent: Thursday, November 20, 2014 6:34 PM
> To: archivesspace_users_group at lyralists.lyrasis.org
> Subject: [Archivesspace_Users_Group] partially update a record through API
>
> I am trying to partially update accession records by setting PUBLISH to false using REST API, but I can't get it done successfully.
> For example, run the following command to update one accession record, curl_as username password -d "@accession.json" -v "the AS API url/repositaries/2/accession/1"
>
> accession.json contains
> {
> "publish" : false
> }
>
> but I get the following complaints
>
> {"error":{"id_0":["Property is required but was missing"],"accession_date":["Property is required but was
> missing"]},"warning":null,"invalid_object":"#<JSONModel(:accession)
> {\"publish\"=>true, \"jsonmodel_type\"=>\"accession\",
> \"external_ids\"=>[], \"related_accessions\"=>[], \"subjects\"=>[], \"linked_events\"=>[], \"extents\"=>[], \"dates\"=>[], \"external_documents\"=>[], \"rights_statements\"=>[], \"deaccessions\"=>[], \"related_resources\"=>[], \"restrictions_apply\"=>false, \"access_restrictions\"=>false, \"use_restrictions\"=>false, \"linked_agents\"=>[], \"instances\"=>[]}>"}
>
>
> Any idea?
>
> Mang Sun
> Rice U.
>
> _______________________________________________
> Archivesspace_Users_Group mailing list
> Archivesspace_Users_Group at lyralists.lyrasis.org
> http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group
> _______________________________________________
> Archivesspace_Users_Group mailing list
> Archivesspace_Users_Group at lyralists.lyrasis.org
> http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group
> _______________________________________________
> Archivesspace_Users_Group mailing list
> Archivesspace_Users_Group at lyralists.lyrasis.org
> http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group
>
> _______________________________________________
> Archivesspace_Users_Group mailing list
> Archivesspace_Users_Group at lyralists.lyrasis.org
> http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4943 bytes
Desc: not available
URL: <http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/attachments/20141125/6ffad70b/attachment.bin>
More information about the Archivesspace_Users_Group
mailing list