Skip to content

Manage Sequences

Jana Rajakumar edited this page Feb 21, 2018 · 6 revisions

Reference: https://iiif.library.utoronto.ca/presentation/v2/#!/Sequence/SequenceByItemGet

Table of Contents

IIIF Reference: http://iiif.io/api/presentation/2.1/#sequence

Create a Sequence

  • A sequence can be created by sending a POST request to {identifier}/sequence with the required parameters.
  • For example:
{
  "sequence": {
    "@id": "http://example.org/iiif/book1/sequence/normal",
    "@type": "sc:Sequence",
    "label": "Current Page Order",
    "viewingDirection": "left-to-right",
    "viewingHint": "paged",
    "startCanvas": "http://example.org/iiif/book1/canvas/p2",
    "canvases": [
      {
        "@id": "http://example.org/iiif/book1/canvas/p1",
        "@type": "sc:Canvas",
        "label": "p. 1"
      },
      {
        "@id": "http://example.org/iiif/book1/canvas/p2",
        "@type": "sc:Canvas",
        "label": "p. 2"
      },
      {
        "@id": "http://example.org/iiif/book1/canvas/p3",
        "@type": "sc:Canvas",
        "label": "p. 3"
      }
    ]
  }
}
  • This would create the sequence for the identifier book1 with name normal and also create all of its provided sub-canvases recursively.
  • Each sub-canvas will have an upward link to this sequence defined in their belongsTo field with this sequence @id.
  • The new sequence will also have a list of @ids in its children field. This value along with the belongsTo are later used to re-construct the sequence when viewing.
  • Suppose any of the sub-canvas already exists, those objects will be updated with any new values from this request. Those objects will also be updated to have their belongsTo field to contain this new sequence @id.

Update a Sequence

  • A sequence can be updated by sending a PUT request to /{identifier}/sequence/{name} with fields that need to be updated.
  • Updating a sequence without any of its sub-canvases in the request body would not affect its children unless the @id is being changed. In this case, an internal update will be performed on all of its children to update their belongsTo values.
  • Suppose any of the sub-canvas does not exist, those objects will be created with new values from this request. Those objects will also be updated to have their belongsTo field to contain this new sequence @id.

Delete a Sequence

  • A sequence can be deleted by sending a DELETE request to /{identifier}/sequence/{name}. Beware that this will also delete all sub-canvases under this sequence recursively.

View a Sequence

  • A single sequence can be viewed at /{identifier}/sequence/{name}. This lists all sub-canvases that have the requested sequence @id in their belongsTo field.

FAQ

  • How to create a sequence without an @id?

  • A POST with no @id in the request body will auto-generate a unique UUID name for that object with the provided identifier.

  • How to hide a specific sub-canvas when viewing a sequence ?

  • This can be achieved by sending a PUT request to the object that needs to be hidden by updating the hidden property to true.

{"canvas: {"hidden": true}}
  • How to change the order of sub-canvases of a parent sequence?
  • This can be achieved by sending a PUT request to the parent sequence with the correct order of @ids for sub-canvases.
  • This would auto-update the order field of all the sub-canvases.
{"sequence": {
 "images": [{"@id": "id-of-canvas-1"}, {"@id": "id-of-canvas-2"}]
}}
Clone this wiki locally