Skip to content

Manage Ranges

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

Reference: https://iiif.library.utoronto.ca/presentation/v2/#!/Range/RangeByItemGet

Table of Contents

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

Create a Sequence

  • A range can be created by sending a POST request to {identifier}/range with the required parameters.
  • For example:
{
  "range": {
    "@id": "http://example.org/iiif/book1/range/r0",
    "@type": "sc:Range",
    "label": "Table of Contents",
    "viewingHint": "top",
    "members": [
      {
        "@id": "http://example.org/iiif/book1/canvas/cover",
        "@type": "sc:Canvas",
        "label": "Front Cover"
      },
      {
        "@id": "http://example.org/iiif/book1/range/r1",
        "@type": "sc:Range",
        "label": "Introduction",
        "contentLayer": "http://example.org/iiif/book1/layer/introTexts"
      },
      {
        "@id": "http://example.org/iiif/book1/canvas/backCover",
        "@type": "sc:Canvas",
        "label": "Back Cover"
      }
    ]
  }
}
  • This would create the range for the identifier book1 with name r0 and also create all of its provided sub-canvases and ranges recursively.
  • Each sub-canvases and ranges will have an upward link to this range defined in their belongsTo field with this range @id.
  • The new range will also have a list of @ids in its children field. This value along with the belongsTo are later used to re-construct the range when viewing.
  • Suppose any of the sub-canvas or range 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 range @id.

Update a Range

  • A range can be updated by sending a PUT request to /{identifier}/range/{name} with fields that need to be updated.
  • Updating a range without any of its sub-canvases or ranges 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 or range 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 range @id.

Delete a Range

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

View a Range

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

FAQ

  • How to create a range 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 or range when viewing a range ?

  • 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}} or "range: {"hidden": true}}
  • How to change the order of sub-canvases or ranges of a parent range?
  • This can be achieved by sending a PUT request to the parent range with the correct order of @ids for sub-canvases and ranges.
  • This would auto-update the order field of all the sub-canvases and ranges.
  • It is important to update the members property rather than the individual canvases and ranges property.
{"range": {
 "members": [{"@id": "id-of-canvas-1"}, {"@id": "id-of-range-2"}]
}}
Clone this wiki locally