[Archivesspace_Users_Group] [EXTERNAL] Re: Error updating resource records through API

Huebschen, Alan M ahueb2 at uis.edu
Mon Apr 20 12:18:16 EDT 2020


Matching the lock number worked perfectly, no change in time stamps needed. 
Thanks everyone!

On Friday, April 17, 2020 6:49:26 PM CDT James Bullen wrote:
> You can just send back the lock_version you got with the get. No need to
> bump it - that happens on a successful update. The response to the update
> will include the new lock_version, like this:
> 
> {
>   "status": "Updated",
>   "id": 2,
>   "lock_version": 23,
>   "stale": NULL,
>   "uri": "/repositories/2",
>   "warnings": []
> }
> 
> This is implemented via a sequel plugin:
> https://sequel.jeremyevans.net/rdoc-plugins/classes/Sequel/Plugins/Optimisti
> cLocking.html
> > On Apr 18, 2020, at 12:53 AM, Peter Heiner <ph448 at cam.ac.uk> wrote:
> > 
> > Huebschen, Alan M wrote on 2020-04-17 14:26:24:
> >> I've been attempting to update existing resource records through the API,
> >> the records already exist and I'm trying to upload modified versions of
> >> the JSON but I'm getting an error in response.
> >> 
> >> 'error': 'The record you tried to update has been modified since you
> >> fetched it.'> 
> > To update a record, you first need to fetch it to get its lock_version.
> > The API will only allow updates to a resource with a lock_version
> > greater than the one stored in the database, so you'll need to post your
> > data including lock_version+1.
> > 
> > Hope that helps,
> > p
> > _______________________________________________
> > Archivesspace_Users_Group mailing list
> > Archivesspace_Users_Group at lyralists.lyrasis.org
> > http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group
> > 
> > !DSPAM:5e99c2e335501411550710!





More information about the Archivesspace_Users_Group mailing list