Dear all, Hello, this is Corey Schmidt, ArchivesSpace Project Manager at the University of Georgia. I hope you all are doing well and staying cool!
I'm trying to update records via the API using the Update a Resource endpoint (https://archivesspace.github.io/archivesspace/api/#update-a-resource). I found Duke made a script (https://github.com/duke-libraries/archivesspace-duke-scripts/blob/master/python/asnake_update_all_resources_and_aos.py) to do this very thing and I modeled my request on that example. I also found what I think is the code for the endpoint, found in backend/app/controllers/resource.rb file, line 114 (https://github.com/archivesspace/archivesspace/blob/0c4cb2dd263bbeacdbce70567ccbb86634cde769/backend/app/controllers/resource.rb#L114). However, no matter the combinations I try for the request, I'm getting a <Response [400]> error with the following message: "error":"Had some trouble parsing your request: unexpected token at <proceeds to quote entire json record> The following is the code I'm running in python: get_resource = client.get('/repositories/5/resources/1814') print(get_resource.text) resource = json.loads(get_resource.text) resource["restrictions"] = True print(json.dumps(resource)) update_resource = client.post('/repositories/5/resources/1814', json=json.dumps(resource)) # update_resource = client.post('/repositories/5/resources/1814', params={"id": 1814, "resource": json.dumps(resource), "repo_id": 5}) # the last line produces this error: <Response [400]> {"error":"Had some trouble parsing your request: A JSON text must at least contain two octets!"} print(update_resource, update_resource.text) I've attached the json file to this email. Any help would be greatly appreciated. Thanks! Sincerely, Corey Schmidt ArchivesSpace Project Manager University of Georgia Special Collections Libraries Email: corey.schm...@uga.edu
resource.json
Description: resource.json
_______________________________________________ Archivesspace_Users_Group mailing list Archivesspace_Users_Group@lyralists.lyrasis.org http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group