Skip to content

Manage Layers

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

Reference: https://iiif.library.utoronto.ca/presentation/v2/#!/Layer/LayerByItemGet

Table of Contents

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

Create a Layer

  • A layer can be created by sending a POST request to {identifier}/layer with the required parameters.
  • For example:
{
  "layer": {
    "@context": "http://iiif.io/api/presentation/2/context.json",
    "@id": "http://example.org/iiif/book1/layer/transcription-3",
    "@type": "sc:Layer",
    "label": "Diplomatic Transcription",
    "otherContent": [
      "http://example.org/iiif/book1/list/l1",
      "http://example.org/iiif/book1/list/l2",
      "http://example.org/iiif/book1/list/l3",
      "http://example.org/iiif/book1/list/l4"
    ]
  }
}
  • This would create the layer for the identifier book1 with name transcription-3 and also create all of its provided sub-annotationLists recursively.
  • Each sub-annotationList will have an upward link to this layer defined in their belongsTo field with this sequence @id.
  • The new layer will also have a list of @ids in its children field. This value along with the belongsTo are later used to re-construct the layer when viewing.
  • Suppose any of the sub-annotationList 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 layer @id.

Update a Layer

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

Delete a Layer

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

View a Layer

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

FAQ

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

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

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