OR2018 Workshop - Getting Started With DSpace 7 REST API
OR2018 Workshop - Getting Started With DSpace 7 REST API
https://github.com/DSpace/DSpace/tree/master/dspace-spring-rest
HATEOAS, HAL, & ALPS, oh my!
HATEOAS = Hypertext As The Engine Of Application State
In each response, include “links” to available next requests.
Results in better decoupling, as API is self-describing.
curl "https://dspace7.4science.it/terry/api/core/collections"
• HAL Browser
• Postman
• Response Properties
– Often pagination details
• Links
– What you can do next
• Embedded Resources
– List of objects which may contain
• Properties
• Links
Open the API Landing Page
• https://github.com/DSpace/Rest7Contract
– Explore the list of endpoints
• Implemented
• Unimplemented
• Under discussion
– Use GitHub pull requests to suggest
changes
The future of REST API Documentation
PR#1915
REST Authentication
http://bit.ly/dspace7-rest
Limitations of HAL Authn
http://bit.ly/dspace7-rest
Postman - Authenticating as a User
AuthN Status in Postman
(no AuthN token)
Authenticating in Postman
AuthN Status in Postman
(passing Bearer token)
Let’s Attempt to change data
http://bit.ly/dspace7-rest
Managing Postman
https://github.com/4Science/DSpace
• It is defined in the
Repository design pattern
• It implements the Data Access Layer in
DDD
• Close to the domain model, abstracting
access to a collection
Resource Class
[or18-ws4]
Enhancing EPerson endpoint
[or18-ws5]
Enhancing EPerson endpoint
Sign-up now!
https://tinyurl.com/dspace7sprints
Questions?
Slides available at
https://tinyurl.com/or2018-dspace-rest
Sl