-
Notifications
You must be signed in to change notification settings - Fork 1
Manage Layers
Jana Rajakumar edited this page Feb 21, 2018
·
5 revisions
Reference: https://iiif.library.utoronto.ca/presentation/v2/#!/Layer/LayerByItemGet
IIIF Reference: http://iiif.io/api/presentation/2.1/#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 nametranscription-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
@id
s in itschildren
field. This value along with thebelongsTo
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
.
- 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 theirbelongsTo
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
.
- 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.
- A single layer can be viewed at
/{identifier}/layer/{name}
. This lists all sub-annotationLists that have the requested layer@id
in theirbelongsTo
field.
-
How to create a layer without an
@id
? -
A
POST
with no@id
in the request body will auto-generate a unique UUIDname
for that object with the providedidentifier
. -
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 thehidden
property totrue
.
{"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@id
s 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"}]
}}