Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

MethodEndpointDescription
GET/REST API static documentation page
POST/login

Login to the REST API using a DSpace EPerson / User. It returns an dspace-rest-token, that can be used for future authenticated requests.

Example Request:

curl -H "Content-Type: application/json" --data '{"email":"admin@dspace.org", "password":"dspace"}' http://localhost:8080/rest/login

Example Response:

1febef81-5eb6-4e76-a0ea-a5be245563a5

Invalid email/password combinations will receive an HTTP 403 Forbidden.

POST/logout

Logout from the REST API, by providing a header rest-dspace-token. After being posted this token will no longer work.

Example Request:

curl -X POST -H "Content-Type: application/json" -H "rest-dspace-token: 1febef81-5eb6-4e76-a0ea-a5be245563a5" http://localhost:8080/rest/logout

Invalid token will result in HTTP 400 Invalid Request

GET/test

Returns string "REST api is running", for testing that the API is up.

Example Request:

curl http://localhost:8080/rest/test

Example Response:

REST api is running.

GET/status

Receive information about the currently authenticated user token.

Example Request:

curl -X GET -H "Content-Type: application/json" -H "Accept: application/json" -H "rest-dspace-token: f2f478e2-90f2-4e77-a757-4e838ae94154" http://localhost:8080/rest/status

Example Response:
{"okay":true,"authenticated":true,"email":"admin@dspace.org","fullname":"DSpace Administrator","token":"f2f478e2-90f2-4e77-a757-4e838ae94154"}

Communities

Communities in DSpace are used for organization and hierarchy, and are containers that hold sub-Communities and Collections. (ex: Department of Engineering)

  • GET /communities - Returns array of all communities in DSpace.
  • GET /communities/top-communities - Returns array of all top communities in DSpace.
  • GET /communities/{communityId} - Returns community.
  • GET /communities/{communityId}/collections - Returns array of collections of community.
  • GET /communities/{communityId}/communities - Returns array of subcommunities of community.
  • POST /communities - Create new community at top level. You must post community.
  • POST /communities/{communityId}/collections - Create new collections in community. You must post Collection.
  • POST /communities/{communityId}/communities - Create new subcommunity in community. You must post Community.
  • PUT /communities/{communityId} - Update community. You must put Community
  • DELETE /communities/{communityId} - Delete community.
  • DELETE /communities/{communityId}/collections/{collectionId} - Delete collection in community.
  • DELETE /communities/{communityId}/communities/{communityId2} - Delete subcommunity in community.

Collections

Collections in DSpace are containers of Items. (ex: Engineering Faculty Publications)

  • GET /collections - Return all collections of DSpace in array.
  • GET /collections/{collectionId} - Return collection with id.
  • GET /collections/{collectionId}/items - Return all items of collection.
  • POST /collections/{collectionId}/items - Create posted item in collection. You must post an Item
  • POST /collections/find-collection - Find collection by passed name.
  • PUT /collections/{collectionId} - Update collection. You must put Collection.
  • DELETE /collections/{collectionId} - Delete collection from DSpace.
  • DELETE /collections/{collectionId}/items/{itemId} - Delete item in collection.

Items

...

Items in DSpace represent a "work" and combine metadata and files, known as Bitstreams.

  • GET /items - Return list of items.
  • GET /items/{item id} - Return item.
  • GET /items/{item id}/metadata - Return item metadata.
  • GET /items/{item id}/bitstreams - Return item bitstreams.
  • POST /items/find-by-metadata-field - Find items by metadata entry. You must post a MetadataEntry
  • POST /items/{item id}/metadata - Add metadata to item. You must post an array of MetadataEntry
  • POST /items/{item id}/bitstreams - Add bitstream to item. You must post a Bitstream
  • PUT /items/{item id}/metadata - Update metadata in item. You must put a MetadataEntry
  • DELETE /items/{item id} - Delete item.
  • DELETE /items/{item id}/metadata - Clear item metadata.
  • DELETE /items/{item id}/bitstreams/{bitstream id} - Delete item bitstream.

Bitstreams

Bitstreams are files. They have a filename, size (in bytes), and a file format. Typically in DSpace, the Bitstream will the "full text" article, or some other media. Some files are the actual file that was uploaded (tagged with bundleName:ORIGINAL), others are DSpace-generated files that are derivatives or renditions, such as text-extraction, or thumbnails. You can download files/bitstreams. DSpace doesn't really limit the type of files that it takes in, so this could be PDF, JPG, audio, video, zip, or other. Also, the logo for a Collection or a Community, is also a Bitstream.

  • GET /bitstreams - Return all bitstreams in DSpace
  • GET /bitstreams - Return all bitstreams in DSpace.
  • GET /bitstreams/{bitstream id} - Return bitstream.
  • GET /bitstreams/{bitstream id}/policy - Return bitstream policies.
  • GET /bitstreams/{bitstream id} - Return bitstream.
  • GET /bitstreams/{bitstream id}/policy - Return bitstream policies.
  • GET /bitstreams/{bitstream id}/retrieve - Return /retrieve - Return data of bitstream.
  • POST /bitstreams/{bitstream id}/policy - Add policy to item. You must post a ResourcePolicy
  • PUT /bitstreams/{bitstream id}/data - Update data/file of bitstream. You must put the data
  • PUT /bitstreams/{bitstream id} - Update metadata of bitstream. You must put a Bitstream, does not alter the file/data
  • DELETE /bitstreams/{bitstream id} - Delete bitstream from DSpace.
  • DELETE /bitstreams/{bitstream id}/policy/{policy_id} - Delete bitstream policy.

You can access the parent object of a Bitstream (normally an Item, but possibly a Collection or Community when it is its logo) through: /bitstreams/:bitstreamID?expand=parent

 

As the documentation may state "You must post a ResourcePolicy" or some other object type, this means As the documentation may state "You must post a ResourcePolicy" or some other object type, this means that there is a structure of data types, that your XML or JSON must be of type, when it is posted in the body.

Model - Object data types

Here are all of the data types, not all fields are necessary or supported when posting/putting content, but the output contains this information:

...

{"okay":true,"authenticated":true,"email":"test@dspace.org","fullname":"DSpace Test User","token":"6d45daaa-7b02-4ae7-86de-a960838fae5c"} 

 

Communities

Communities in DSpace are used for organization and hierarchy, and are containers that hold sub-Communities and Collections. (ex: Department of Engineering)

  
List Communities/communities/
Specific Community/communities/:communityID
Community ExpandsparentCommunity, collections, subCommunities, logo, all

Collections

Collections in DSpace are containers of Items. (ex: Engineering Faculty Publications)

  
List Collections/collections/
Specific Collection/collections/:collectionID
Collection ExpandsparentCommunityList, parentCommunity, items, license, logo, all

You can access all the collections in a specific community through: /communities/:communityID?expand=all

Items

Items in DSpace represent a "work" and combine metadata and files, known as Bitstreams.

  
Specific Item/items/:itemID
Item Expandsmetadata, parentCollection, parentCollectionList, parentCommunityList, bitstreams, all

You can access all the items in a specific collection through: /collections/:collectionID?expand=items

Bitstreams

Bitstreams are files. They have a filename, size (in bytes), and a file format. Typically in DSpace, the Bitstream will the "full text" article, or some other media. Some files are the actual file that was uploaded (tagged with bundleName:ORIGINAL), others are DSpace-generated files that are derivatives or renditions, such as text-extraction, or thumbnails. You can download files/bitstreams. DSpace doesn't really limit the type of files that it takes in, so this could be PDF, JPG, audio, video, zip, or other. Also, the logo for a Collection or a Community, is also a Bitstream.

  
Specific Bitstream/bitstreams/:bitstreamID
Download a Bitstream/bitstreams/:bitstreamID/retrieve
Bitstream Expandsparent, all

You can access all the Bitstreams in a specific Item through: /items/:itemID?expand=bitstreams

You can access the parent object of a Bitstream (normally an Item, but possibly a Collection or Community when it is its logo) through: /bitstreams/:bitstreamID?expand=parent

Introduction to Jersey for developers

...