-
Notifications
You must be signed in to change notification settings - Fork 1
Manage Ranges
Jana Rajakumar edited this page Feb 21, 2018
·
5 revisions
Reference: https://iiif.library.utoronto.ca/presentation/v2/#!/Range/RangeByItemGet
IIIF Reference: http://iiif.io/api/presentation/2.1/#range
- 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 namer0
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
@id
s in itschildren
field. This value along with thebelongsTo
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
.
- 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 theirbelongsTo
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
.
- 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.
- A single range can be viewed at
/{identifier}/range/{name}
. This lists all sub-canvases and ranges that have the requested range@id
in theirbelongsTo
field.
-
How to create a range 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-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 thehidden
property totrue
.
{"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@id
s 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 individualcanvases
andranges
property.
{"range": {
"members": [{"@id": "id-of-canvas-1"}, {"@id": "id-of-range-2"}]
}}