Skip to content

Commit

Permalink
Updated README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
helix84 committed Mar 16, 2015
1 parent 6f45627 commit c3900cf
Showing 1 changed file with 47 additions and 47 deletions.
94 changes: 47 additions & 47 deletions dspace-rest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This REST API is integrated directly into the DSpace codebase.
* ```<Context path="/rest" docBase="/dspace/webapps/rest" />```


At this time, REST API can do all CRUD operations over communities, collections, items, bitstream and bitstream policies. Without logging into the REST API, you have read access as an anynomous user (member of the Anonymous group). If you want to make changes in DSpace using the REST API, you must log into the API using the "login" endpoint and then use the returned token in request header of your subsequent API calls.
REST API can do all CRUD (create, read, update, delete) operations over communities, collections, items, bitstream and bitstream policies. Without logging into the REST API, you have read access as an anonymous user (member of the Anonymous group). If you want to make changes in DSpace using the REST API, you must log into the API using the "login" endpoint and then use the returned token in request header of your subsequent API calls.

##Endpoints

Expand All @@ -28,156 +28,156 @@ Get information on how to use the API
- GET http://localhost:8080

Test whether the REST API is running and available
- GET http://localhost:8080/test
- GET http://localhost:8080/rest/test

Log into REST API
- POST http://localhost:8080/login
- POST http://localhost:8080/rest/login

Logout from REST API
- POST http://localhost:8080/logout
- POST http://localhost:8080/rest/logout

Get status of REST API and the logged-in user
- GET http://localhost:8080/status
- GET http://localhost:8080/rest/status


###Communities
View the list of top-level communities
- GET http://localhost:8080/communities/top-communities
- GET http://localhost:8080/rest/communities/top-communities

View the list of all communities
- GET http://localhost:8080/communities[?expand={collections,parentCommunity,subCommunities,logo,all}]
- GET http://localhost:8080/rest/communities[?expand={collections,parentCommunity,subCommunities,logo,all}]

View a specific community
- GET http://localhost:8080/communities/:ID[?expand={collections,parentCommunity,subCommunities,logo,all}]
- GET http://localhost:8080/rest/communities/:ID[?expand={collections,parentCommunity,subCommunities,logo,all}]

View the list of subcollections in community
- GET http://localhost:8080/communities/:ID/collections[?expand={items,parentCommunityList,license,logo,all}]
- GET http://localhost:8080/rest/communities/:ID/collections[?expand={items,parentCommunityList,license,logo,all}]

View the list of subcommunities in community
- GET http://localhost:8080/communities/:ID/communities[?expand={collections,parentCommunity,subCommunities,logo,all}]
- GET http://localhost:8080/rest/communities/:ID/communities[?expand={collections,parentCommunity,subCommunities,logo,all}]

Create new top-level community
- POST http://localhost:8080/communities
- POST http://localhost:8080/rest/communities

Create new subcollection in community
- POST http://localhost:8080/communities/:ID/collections
- POST http://localhost:8080/rest/communities/:ID/collections

Create new subcommunity in community
- POST http://localhost:8080/communities/:ID/communities
- POST http://localhost:8080/rest/communities/:ID/communities

Update community
- PUT http://localhost:8080/communities/:ID
- PUT http://localhost:8080/rest/communities/:ID

Delete community
- DELETE http://localhost:8080/communities/:ID
- DELETE http://localhost:8080/rest/communities/:ID

Delete subcollection in community
- DELETE http://localhost:8080/communities/:ID/collections/:ID
- DELETE http://localhost:8080/rest/communities/:ID/collections/:ID

Delete subcommunity in community
- DELETE http://localhost:8080/communities/:ID/communities/:ID
- DELETE http://localhost:8080/rest/communities/:ID/communities/:ID


###Collections
View the list of collections
- GET http://localhost:8080/collections[?expand={items,parentCommunityList,license,logo,all}]
- GET http://localhost:8080/rest/collections[?expand={items,parentCommunityList,license,logo,all}]

View a specific collection
- GET http://localhost:8080/collections/:ID[?expand={items,parentCommunityList,license,logo,all}]
- GET http://localhost:8080/rest/collections/:ID[?expand={items,parentCommunityList,license,logo,all}]

View items in collection
- GET http://localhost:8080/collections/:ID/items[?expand={metadata,parentCollection,parentcollectionList,parentCommunityList,bitstreams,all}]
- GET http://localhost:8080/rest/collections/:ID/items[?expand={metadata,parentCollection,parentcollectionList,parentCommunityList,bitstreams,all}]

Create item in collection
- POST http://localhost:8080/collections/:ID/items
- POST http://localhost:8080/rest/collections/:ID/items

Find collection by name
- POST http://localhost:8080/collections/find-collection
- POST http://localhost:8080/rest/collections/find-collection

Update collection
- PUT http://localhost:8080/collections/:ID
- PUT http://localhost:8080/rest/collections/:ID

Delete collection
- DELETE http://localhost:8080/collections/:ID
- DELETE http://localhost:8080/rest/collections/:ID

Delete item in collection
- DELETE http://localhost:8080/collections/:ID/items/:ID
- DELETE http://localhost:8080/rest/collections/:ID/items/:ID


###Items
View the list of items
- GET http://localhost:8080/items[?expand={metadata,parentCollection,parentcollectionList,parentCommunityList,bitstreams,all}]
- GET http://localhost:8080/rest/items[?expand={metadata,parentCollection,parentcollectionList,parentCommunityList,bitstreams,all}]

View speciific item
- GET http://localhost:8080/items/:ID[?expand={metadata,parentCollection,parentcollectionList,parentCommunityList,bitstreams,all}]
- GET http://localhost:8080/rest/items/:ID[?expand={metadata,parentCollection,parentcollectionList,parentCommunityList,bitstreams,all}]

View an Item and view its bitstreams
- GET http://localhost:8080/items/:ID/bitstreams[?expand={parent,policies,all}]
- GET http://localhost:8080/rest/items/:ID/bitstreams[?expand={parent,policies,all}]

View an Item, and view its metadata
- GET http://localhost:8080/items/:ID/metadata
- GET http://localhost:8080/rest/items/:ID/metadata

Find item by metadata
- POST http://localhost:8080/items/find-by-metadata-field
- POST http://localhost:8080/rest/items/find-by-metadata-field

Add metadata to item
- POST http://localhost:8080/items/:ID/metadata
- POST http://localhost:8080/rest/items/:ID/metadata

Create bitstream in item
- POST http://localhost:8080/items/:ID/bitstreams
- POST http://localhost:8080/rest/items/:ID/bitstreams

Update metadata in item
- PUT http://localhost:8080/items/:ID/metadata
- PUT http://localhost:8080/rest/items/:ID/metadata

Delete item
- DELETE http://localhost:8080/items/:ID
- DELETE http://localhost:8080/rest/items/:ID

Delete all metadata in item
- DELETE http://localhost:8080/items/:ID/metadata
- DELETE http://localhost:8080/rest/items/:ID/metadata

Delete bitstream in item
- DELETE http://localhost:8080/items/:ID/bitstreams/:ID
- DELETE http://localhost:8080/rest/items/:ID/bitstreams/:ID


###Bitstreams
View the list of bitstreams
- GET http://localhost:8080/bitstreams[?expand={parent,policies,all}]
- GET http://localhost:8080/rest/bitstreams[?expand={parent,policies,all}]

View information about a bitstream
- GET http://localhost:8080/bitstreams/:ID[?expand={parent,policies,all}]
- GET http://localhost:8080/rest/bitstreams/:ID[?expand={parent,policies,all}]

View/Download a specific Bitstream
- GET http://localhost:8080/bitstreams/:ID/retrieve
- GET http://localhost:8080/rest/bitstreams/:ID/retrieve

View the list of policies of bitstream
- GET http://localhost:8080/bitstreams/:ID/policy
- GET http://localhost:8080/rest/bitstreams/:ID/policy

Add policy to bitstream
- POST http://localhost:8080/bitstreams/:ID/policy
- POST http://localhost:8080/rest/bitstreams/:ID/policy

Update bitstream
- PUT http://localhost:8080/bitstreams/:ID
- PUT http://localhost:8080/rest/bitstreams/:ID

Update data of bitstream
- PUT http://localhost:8080/bitstreams/:ID/data
- PUT http://localhost:8080/rest/bitstreams/:ID/data

Delete bitstream
- DELETE http://localhost:8080/bitstreams/:ID
- DELETE http://localhost:8080/rest/bitstreams/:ID

Delete policy of bitstream
- DELETE http://localhost:8080/bitstreams/:ID/policy/:ID
- DELETE http://localhost:8080/rest/bitstreams/:ID/policy/:ID


####Statistics
Recording view events of items and download events of bitstreams (set stats = true in rest.cfg to enable recording of events)
http://localhost:8080/items/:ID?userIP=ip&userAgent=userAgent&xforwardedfor=xforwardedfor
http://localhost:8080/rest/items/:ID?userIP=ip&userAgent=userAgent&xforwardedfor=xforwardedfor
If no parameters are given, the details of the HTTP request sender are used in statistics.
This enables tools like proxies to supply the details of their user rather than themselves.


###Handles
Lookup a DSpaceObject by its Handle, this produces the name/ID that you look up in /bitstreams, /items, /collections, /communities
- http://localhost:8080/handle/{prefix}/{suffix}
- http://localhost:8080/rest/handle/{prefix}/{suffix}

##Expand
There is an ?expand= query parameter for more expensive operations. You can add it at the end of the request URL.
Expand Down

0 comments on commit c3900cf

Please sign in to comment.