Versions Compared

Key

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

...

Another thing to note is that there are Query Parameter's Parameters that you can tack on to the end of an endpoint to do extra things. The most commonly used one in this API is "?expand". Instead of every API call defaulting to giving you every possible piece of information about it, it only gives out gives a most commonly used set by default and gives the more "expensive" information when you deliberately request it. Each endpoint will provide a list of available expands in the output, but for getting started, you can start with ?expand=all, to make the endpoint provide all of its information (parent objects, metadata, child objects).

...

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 Expands

...

parentCommunity, 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=allCollection Expands: parentCommunityList, parentCommunity, items, license, logo, 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

Item Expands: metadata, parentCollection, parentCollectionList, parentCommunityList, bitstreams, all

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

Bitstream Expands: parent, all

Introduction to Jersey for developers

...

Code Block
languagejava
@Path("/collections")
public class CollectionsResource {
    @GET
    @Path("/")
    @Produces(MediaType.TEXT_HTML)
    public String listHTML() {...}


    @GET
    @Path("/")
    @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
    public org.dspace.rest.common.Collection[] list(@QueryParam("expand") String expand) {...}


    @GET
    @Path("/{collection_id}")
    @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
    public org.dspace.rest.common.Collection getCollection(@PathParam("collection_id") Integer collection_id, @QueryParam("expand") String expand) {...}

 

There was no central ProviderRegistry that you have to declare your path. Your free to use @annotations to get your code to respond to requests. There are helpful parameter helpers to extract parameters into Java variables. 

Additional Information

Additional information can be found in the README for dspace-rest, and in the GitHub Pull Request for DSpace REST (Jersey).

...