Dmitry Mozzherin edited this page Aug 16, 2013 · 9 revisions

All Resources

Based on DSpace Rest API plugin, Revision 73

Authentication

Authentication by email and password

email (string) : email registered at dspace

password (string) : password registered at dspace

http://example.com/rest/items.xml?email=johndoe@example.com&password=secret

Authentication by public and private api keys via digest.

api_key (string) : your public api key

api_digest (string) : api digest generated as described below

http://example.com/rest/items.xml?api_key=ab11cd22&api_digest=25b1c8df

You can register one or more api_keys using api interface at /api_keys. Then you have to use SHA1 algorithm to generate api digest out of url’s path and your private key. You need first 8 characters of the digest. Url request will be authorized by your public key and generated api digest. Example below describes how to generate a digest in Ruby

      require 'digest'
      # if url is http://example.org/rest/communities/14.xml?idOnly=true
      # public key is 12345678
      # private key is 1234567890abcdef
      # concatenate path (without parameters and host name) with private key
      # use SHA1 algorithm to get hexdigest of the string.
      # take first 8 characters of the resulting string.
      
      digest = Digest::SHA1.hexdigest('/rest/communities/14.xml' + '1234567890abcdef')[0..7] 
      # digest should be "596f9b32"

Final url would look like:

http://example.org/rest/communities/14.xml?idOnly=true&api_key=12345678&api_digest=596f9b32

Other common parameters

When searching for entities in a list, the following parameters are handled specially in the system (note that all the RoR conventions are followed for sorting/paging):

_start (number): the position of the first entity to return (0 is the first), e.g. _start=5

_page (number): the page of data to display (0 is first), e.g. _page=2

_perpage (number): the number of entities to return for the page (0 means all), e.g. _perpage=20

_limit (number): the maximum number of entities to return (0 means all), e.g. _limit=50

_order (string): the sort order to return entities in (default is ascending), should be a comma separated list of entity field names which optionally include a suffix to determine order, suffix can be _reverse or _desc for descending order OR ’’ (blank) or _asc for ascending order, e.g. _order=name OR order=namereverse OR order=name,email_desc,firstname_asc,lastnamereverse

_sort (string): same as order

Please note that there are different fields supported for ordering accross entities. For information about supported options for specific entity, please consult related description page.

Resources

Bitstream
Returns info on requested bitstream, with xml extension, or downloads bitstream file if no extension is given.

#returns metadata
/rest/bitstream/1.xml

#returns bitsream itself with file data in the header
/rest/bitstream/1

Collections
Returns list of collections

/rest/collections.xml
/rest/collections/1.xml

Communities
Returns list of communities

/rest/communities.xml
/rest/communities/1.xml

Harvest
Returns items created/modified within specified time range

/rest/harvest.xml?startdate=2001-01-01&enddate=2001-12-31

Items
Returns list of items

/rest/items.xml
/rest/items/1.xml
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.