-
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
POSTrequest to{identifier}/rangewith 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
book1with namer0and 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
belongsTofield with this range@id. - The new range will also have a list of
@ids in itschildrenfield. This value along with thebelongsToare 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
belongsTofield to contain this new range@id.
- A range can be updated by sending a
PUTrequest 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
@idis being changed. In this case, an internal update will be performed on all of its children to update theirbelongsTovalues. - 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
belongsTofield to contain this new range@id.
- A range can be deleted by sending a
DELETErequest 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@idin theirbelongsTofield.
-
How to create a range without an
@id? -
A
POSTwith no@idin the request body will auto-generate a unique UUIDnamefor 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
PUTrequest to the object that needs to be hidden by updating thehiddenproperty 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
PUTrequest to the parent range with the correct order of@ids for sub-canvases and ranges. - This would auto-update the
orderfield of all the sub-canvases and ranges. - It is important to update the
membersproperty rather than the individualcanvasesandrangesproperty.
{"range": {
"members": [{"@id": "id-of-canvas-1"}, {"@id": "id-of-range-2"}]
}}