Skip to content

Manage Collections

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

Reference: https://iiif.library.utoronto.ca/presentation/v2/#!/Collection/CollectionsGet

Table of Contents

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

Create a Collection

  • A collection can be created by sending a POST request to /collections with the required parameters.
  • For example:
{
  "collection": {
    "@id": "http://example.org/iiif/collections/to-p",
    "label": "some collection label parent",
    "collections": [
      {
        "@id": "http://example.org/iiif/collections/top6",
        "label": "some colelction label child"
      },
      {
        "@id": "http://example.org/iiif/collections/top98",
        "label": "anothoer colelction label child"
      }
    ],
    "manifests": [
      {
        "@id": "http://example.org/iiif/book1/manifest",
        "label": "some manifest label parent"
      },
      {
        "@id": "http://example.org/iiif/book2/manifest",
        "label": "some manifest label"
      }
    ],
    "members": [
      {
        "@id": "http://example.org/iiif/book3/manifest",
        "label": "some manifest label parent",
        "@type": "sc:Manifest"
      },
      {
        "@id": "http://example.org/iiif/collections/top6666",
        "label": "some manifest label",
        "@type": "sc:Collection"
      }
    ]
  }
}
  • This would create the collection to-p and also create all of its sub-collections and manifests provided.
  • Each sub-collection and manifest will have an upward link to this collection defined in their belongsTo field with this collection @id.
  • The new collection will also have a list of @ids in its children field. This value along with the belongsTo are later used to re-construct the collection when viewing.
  • Suppose any of the sub-collection or manifest 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 collection @id.

Update a Collection

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

Delete a Collection

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

View Top Level Collection

  • The top level UofT collection can be viewed at /collections. This lists all sub-collections and manifests that have their belongsTo field to an empty list.

View a Collection

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

FAQ

  • How to create a collection without an @id?

  • A POST with no @id in the request body will auto-generate a unique UUID name for that object.

  • How to hide a specific sub-collection or manifest when viewing a collection ?

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

{"collection: {"hidden": true}} or {"manifest: {"hidden": true}}
  • How to change the order of sub-collections or manifests of a parent collection?
  • This can be achieved by sending a PUT request to the parent collection with the correct order of @ids for sub-collections and manifests.
  • This would auto-update the order field of all the sub-collections and manifests.
{"collection": {
 "collections": [{"@id": "id-of-collection-1"}, {"@id": "id-of-collection-2"}], 
 "manifests": [{"@id": "id-of-manifest-1"}, {"@id": "id-of-manifest-2"}]
}}