Harvard Wiki has been integrated with Group Services.
Wiki administrators: visit IT Help for an overview of the changes to managing groups in your wikis.
Skip to end of metadata
Go to start of metadata

Overview

The LibraryCloud Collections API provides access to metadata about groups of items in the Harvard Library collections, and allows creation and editing of new groups of items

Base URI

http://api.lib.harvard.edu/v2/collections

Retrieve all collections

http://api.lib.harvard.edu/v2/collections

Retrieve an individual collection by id

A single collection can be retrieved by its unique identifier:
http://api.lib.harvard.edu/v2/collections/[ID]

Search Query

The simplest search query to the API includes only a search term:
http://api.lib.harvard.edu/v2/collections?q=peanuts

Search Response

The response to any search query contains the total number of matching records, the number of records included within this response, the page number of this response, and the matching records. The individual records are represented using a subset of the Dublin Core Collections Applications Profile (DCCAP).

Searching by Field

A query can be limited to a particular field:
http://api.lib.harvard.edu/v2/collections?title=peanuts
This query returns all items with the text “peanuts” in the title field.

Searching by items

A query can retrieve all collections to which an item belongs:
http://api.lib.harvard.edu/v2/collections?contains=[ITEM_ID]
This query returns all items that contains the item identified by ITEM_ID

Retrieving items within a collection

A list of items from within a collection can be retrieved by the collection's unique identifier:
http://api.lib.harvard.edu/v2/collections/[ID]/items

Paging, Sorting, Faceting, Response Serialization, Cross-Domain Queries, API Versioning

See the relevant sections in the LibraryCloud Item API documentation.

Field Reference

This section describes the fields available for searching through the API.

NameKeyword SearchExact Match SearchCan SortCan Facet
titleYesNoYesNo
identifierNoYesYesNo
abstractYesNoNoNo

Authentication

Any POST, PUT, or DELETE request to the Collections API requires authentication. Authentication is performed by passing an API key in the “X-LibraryCloud-API-Key” request header. All such requests require SSL.

Create a collection

Send a POST request to http://api.lib.harvard.edu/v2/collections passing the collection to be created as the content of the message. Example using curl:

curl -X POST \
-H "X-LibraryCloud-API-Key: ${LC_API_KEY}" \
-H "Content-Type: application/json" \
-d '{"title": "My new collection","abstract":"Lorem ipsum...."}' \
https://api.lib.harvard.edu/v2/collections

If successful, you will receive an HTTP 201 response, with the location of the newly created collection

Status: 201 Created
Location: https://api.lib.harvard.edu/v2/collections/[ID]

In case of error, the API will return an appropriate HTTP error code, and may include a text description of the reason for the error.

Update a collection

Send a PUT request to http://api.lib.harvard.edu/v2/collections/[id] passing the fields to be changed as the content of the message. Example using curl:

curl -X PUT \
-H "X-LibraryCloud-API-Key: ${LC_API_KEY}" \
-H "Content-Type: application/json" \
-d '{"title": "My updated new collection title"}' \
https://api.lib.harvard.edu/v2/collections/ID_OF_MY_COLLECTION

Only the title and abstract fields can be updated

Delete a collection

Send a DELETE request to http://api.lib.harvard.edu/v2/collections/[id]. Example using curl:

curl -X DELETE \
-H "X-LibraryCloud-API-Key: ${LC_API_KEY}" \
-H "Content-Type: application/json" \
https://api.lib.harvard.edu/v2/collections/ID_OF_MY_COLLECTION

Add items to a collection

Send a POST request to http://api.lib.harvard.edu/v2/collections/[id] passing the id or ids of the item(s) to be created as the content of the message. Examples using curl:

curl -X POST \
-H "X-LibraryCloud-API-Key: ${LC_API_KEY}" \
-H "Content-Type: application/json" \
-d '[{"item_id": "ID_OF_OBJECT_TO_ADD"}]' \
https://api.lib.harvard.edu/v2/collections/my_collection_id
curl -X POST \
-H "X-LibraryCloud-API-Key: ${LC_API_KEY}" \
-H "Content-Type: application/json" \
-d '[{"item_id": "ID1"},{"item_id": "ID2"},{"item_id": "ID3"}]' \
https://api.lib.harvard.edu/v2/collections/my_collection_id

Remove an item from a collection

Send a DELETE request to http://api.lib.harvard.edu/v2/collections/[id]/items/[item_id] passing the IDs of the collection, and the item to remove from it.

Example using curl:

curl -X DELETE \
-H "X-LibraryCloud-API-Key: ${LC_API_KEY}" \
-H "Content-Type: application/json" \
https://api.lib.harvard.edu/v2/collections/ID_OF_MY_COLLECTION/items/ID_OF_ITEM_TO_REMOVE


Support

Library Cloud Support

 

 

  • No labels