Responses to DSpace 7 REST API requests are HAL documents which, in accordance with the specification, contain the following two reserved properties:
_links:contains link links to other resources
_embedded:contains embedded resources
Before following this guide as a developer, you should already have a Rest Model object in mind (usually a subclass of
RestAddressableModel, with a name ending with Rest, by convention). That object should already have a few properties, and you should have an idea of what link you want to create from it. You should also have a
Resource subclass in mind (usually a subclass of
Determining the recommended approach
When subresource embedding is optional or pageable, the recommended approach is to create a LinkRestRepository with a method to fulfill provide the requestdata.
Then you can refer to the repository and method to get the content (or first page of the content) via the @LinkRest annotation in the @LinkRest class annotation (inside a @LinksRest annotation)in your Rest Model class. This allow the resource to be exposed as a subresource and permit the optional embedding of it.
This makes it possible to avoid the work of a) querying the database unnecessarily in certain cases, via the entity class used by the Converter, and b) reading in all possible values of a potentially long list into memory.