Bug #12728

It's possible to create more than one DO associated to the same description

Added by Jesús García Crespo over 1 year ago. Updated over 1 year ago.

Status:NewStart date:01/17/2019
Priority:MediumDue date:
Assignee:-% Done:

0%

Category:Web service API
Target version:-
Google Code Legacy ID: Tested version:2.4
Sponsored:No Requires documentation:

Description

Technically, AtoM's data model enforces a 1:1 relation between an information object and a digital object.

However, AtoM's API is letting me create multiple digital objects associated to the same description. This may lead to unexpected results, e.g. the web interface doesn't seem to list the additional digital objects but they're shown in the carousel, and trying to edit the digital object metadata leads to a 500 error.

I would expect the API to error when I try such operation, e.g. 400 bad request.

The endpoints used are:
- POST /informationobjects
- POST /digitalobjects (using the same information_object_slug)

Steps to reproduce

Here's an example on how to reproduce the issue using agentarchives created by the Archivematica team.

from __future__ import print_function

from agentarchives.atom import AtomClient

atom_url = "https://demo.accesstomemory.org" 
atom_key = "..." 

client = AtomClient(atom_url, atom_key)

# Create description: foobar
foobar_slug = client.add_child("faculty-of-law-fonds", "foobar")

# Create description: foobar > sound-recording
child_slug = client.add_child(
    parent_slug=foobar_slug, title="sound-recording")

# Add side-a.wav to Sound Recording
client.add_digital_object(
    information_object_slug=child_slug, title="side-a.wav",
    uri="http://www.music.helsinki.fi/tmt/opetus/uusmedia/esim/a2002011001-e02-ulaw.wav")

# Add side-b.wav to Sound Recording
# THIS SHOULD ERROR BUT IT DOESN'T! DOES ATOM NEED TO BE FIXED?
client.add_digital_object(
    information_object_slug=child_slug, title="side-b.wav",
    uri="http://www.music.helsinki.fi/tmt/opetus/uusmedia/esim/a2002011001-e02-ulaw.wav")

# Bye!
child_url = "{}/{}".format(atom_url, child_slug)
print("Visit", child_url, "for more!")

AtomClient: https://github.com/artefactual-labs/agentarchives/blob/master/agentarchives/atom/client.py

Error encountered

  • The carousel at higher levels of description will show 2 digital objects on the IO, but only one is visible when navigating there
  • When entering the digital object metadata edit page, you can only access the first DO's metadata (side-a)

Expected result

  • AtoM API returns a 400 bad request response when a user attempts to use the API to add multiple digital objects to a single information object

Related issue

History

#1 Updated by Jesús García Crespo over 1 year ago

  • Description updated (diff)

#2 Updated by Dan Gillean over 1 year ago

  • Description updated (diff)

#3 Updated by Dan Gillean over 1 year ago

  • Description updated (diff)

Also available in: Atom PDF