Package org.dspace.app.rest
Class RestResourceController
java.lang.Object
org.dspace.app.rest.RestResourceController
- All Implemented Interfaces:
InitializingBean
@RestController
@RequestMapping("/api/{apiCategory}/{model}")
public class RestResourceController
extends Object
implements InitializingBean
This is the main entry point of the new REST API. Its responsibility is to
provide a consistent behaviors for all the exposed resources in terms of
returned HTTP codes, endpoint URLs, HTTP verbs to methods translation, etc.
It delegates to the repository the business logic
- Author:
- Andrea Bollini (andrea.bollini at 4science.it)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionResponseEntity<org.springframework.hateoas.RepresentationModel<?>>action(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, Integer id) Called in POST, with a x-www-form-urlencoded, execute an action on a resource Note that the regular expression in the request mapping accept a number as identifier;voidResponseEntity<org.springframework.hateoas.RepresentationModel<?>>delete(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, Integer id) Method to delete an entity by ID Note that the regular expression in the request mapping accept a number as identifier;ResponseEntity<org.springframework.hateoas.RepresentationModel<?>>delete(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, String id) ResponseEntity<org.springframework.hateoas.RepresentationModel<?>>delete(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, UUID uuid) <T extends RestAddressableModel>
org.springframework.hateoas.RepresentationModelexecuteSearchMethods(String apiCategory, String model, String searchMethodName, jakarta.servlet.http.HttpServletResponse response, org.springframework.data.domain.Pageable pageable, org.springframework.data.domain.Sort sort, org.springframework.data.web.PagedResourcesAssembler assembler, MultiValueMap<String, Object> parameters) <T extends RestAddressableModel>
org.springframework.hateoas.PagedModel<DSpaceResource<T>>findAll(String apiCategory, String model, org.springframework.data.domain.Pageable page, org.springframework.data.web.PagedResourcesAssembler assembler, jakarta.servlet.http.HttpServletResponse response, MultiValueMap<String, Object> parameters) Find all via a GET request to the root endpoint.Called in GET is used to retrieve the single resource by identifier; Note that the regular expression in the request mapping accept a number as identifier; Please seefindOne(String, String, String)for findOne with string as identifier and seefindOne(String, String, UUID)for uuid as identifierCalled in GET is used to retrieve the single resource by identifier; Note that the regular expression in the request mapping accept a string as identifier but not the other kind of identifier; http://<dspace.server.url>/api/{apiCategory}/{model}/{id} Example:Called in GET is used to retrieve the single resource by identifier; Note that the regular expression in the request mapping accept a UUID as identifier; Please seefindOne(String, String, Integer)for findOne with number as identifier and seefindOne(String, String, String)for string as identifierorg.springframework.hateoas.RepresentationModelfindRel(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String apiCategory, String model, Integer id, String rel, String relid, org.springframework.data.domain.Pageable page, org.springframework.data.web.PagedResourcesAssembler assembler) org.springframework.hateoas.RepresentationModelfindRel(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String apiCategory, String model, Integer id, String rel, org.springframework.data.domain.Pageable page, org.springframework.data.web.PagedResourcesAssembler assembler) Called in GET is used to retrieve the relation resources; Note that the regular expression in the request mapping accept a number;org.springframework.hateoas.RepresentationModelfindRel(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String apiCategory, String model, String id, String rel, String relid, org.springframework.data.domain.Pageable page, org.springframework.data.web.PagedResourcesAssembler assembler) Called in GET, try to retrieve the requested linked resource.org.springframework.hateoas.RepresentationModelfindRel(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String apiCategory, String model, String id, String rel, org.springframework.data.domain.Pageable page, org.springframework.data.web.PagedResourcesAssembler assembler) Called in GET is used to retrieve the relation resources; Note that the regular expression in the request mapping accept a string as identifier but not the other kind of identifier;org.springframework.hateoas.RepresentationModelfindRel(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String apiCategory, String model, UUID uuid, String rel, org.springframework.data.domain.Pageable page, org.springframework.data.web.PagedResourcesAssembler assembler) Called in GET is used to retrieve the relation resources; Note that the regular expression in the request mapping accept a UUID as identifier;org.springframework.hateoas.RepresentationModellistSearchMethods(String apiCategory, String model) ResponseEntity<org.springframework.hateoas.RepresentationModel<?>>patch(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, Integer id, com.fasterxml.jackson.databind.JsonNode jsonNode) PATCH method, using operation on the resources following (JSON) Patch notation (https://tools.ietf .org/html/rfc6902) Note that the regular expression in the request mapping accept a number as identifier;ResponseEntity<org.springframework.hateoas.RepresentationModel<?>>patch(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, String id, com.fasterxml.jackson.databind.JsonNode jsonNode) PATCH method, using operation on the resources following (JSON) Patch notation (https://tools.ietf .org/html/rfc6902) Note that the regular expression in the request mapping accept a UUID as identifier;ResponseEntity<org.springframework.hateoas.RepresentationModel<?>>patch(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, UUID id, com.fasterxml.jackson.databind.JsonNode jsonNode) PATCH method, using operation on the resources following (JSON) Patch notation (https://tools.ietf .org/html/rfc6902) Note that the regular expression in the request mapping accept a UUID as identifier;<ID extends Serializable>
ResponseEntity<org.springframework.hateoas.RepresentationModel<?>>patchInternal(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, ID id, com.fasterxml.jackson.databind.JsonNode jsonNode) Internal patch methodResponseEntity<org.springframework.hateoas.RepresentationModel<?>>post(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, String parent) Execute a POST request; curl -X POST -H "Content-Type:application/json" http://<dspace.server.url>/api/{apiCategory}/{model} Example:<ID extends Serializable>
ResponseEntity<org.springframework.hateoas.RepresentationModel<?>>postJsonInternal(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, String parent) Internal method to execute POST with application/json MediaType;<ID extends Serializable>
ResponseEntity<org.springframework.hateoas.RepresentationModel<?>>postUriListInternal(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model) Internal method to execute POST with text/uri-list MediaType;ResponseEntity<org.springframework.hateoas.RepresentationModel<?>>postWithUriListContentType(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model) Execute a POST request; curl -X POST -H "Content-Type:text/uri-list" http://<dspace.server.url>/api/{apiCategory}/{model} Example:Execute a PUT request for an entity with id of type Integer; curl -X PUT -H "Content-Type:text/uri-list" http://<dspace.server.url>/api/{apiCategory}/{model}/{id} Example:put(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, Integer id, com.fasterxml.jackson.databind.JsonNode jsonNode) Execute a PUT request for an entity with id of type Integer; curl -X PUT -H "Content-Type:application/json" http://<dspace.server.url>/api/{apiCategory}/{model}/{id} Example:put(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, String id, com.fasterxml.jackson.databind.JsonNode jsonNode) Execute a PUT request for an entity with id of type String and containing 32 hexadecimal digits.put(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, UUID uuid, com.fasterxml.jackson.databind.JsonNode jsonNode) Execute a PUT request for an entity with id of type UUID; curl -X PUT http://<dspace.server.url>/api/{apiCategory}/{model}/{uuid} Example:<ID extends Serializable>
ResponseEntity<org.springframework.hateoas.RepresentationModel<?>>upload(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, Integer id, MultipartFile uploadfile) Called in POST, multipart, upload to a specific rest resource the file passed as "file" request parameter Note that the regular expression in the request mapping accept a number as identifier;<ID extends Serializable>
ResponseEntity<org.springframework.hateoas.RepresentationModel<?>>upload(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, String id, MultipartFile uploadfile) Called in POST, multipart, upload to a specific rest resource the file passed as "file" request parameter Note that the regular expression in the request mapping accept a String as identifier;<T extends RestAddressableModel>
ResponseEntity<org.springframework.hateoas.RepresentationModel<?>>upload(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, List<MultipartFile> uploadfile) Upload a file against the collection resource endpoint.<ID extends Serializable>
ResponseEntity<org.springframework.hateoas.RepresentationModel<?>>upload(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, UUID uuid, MultipartFile uploadfile) Called in POST, multipart, upload to a specific rest resource the file passed as "file" request parameter Note that the regular expression in the request mapping accept a UUID as identifier;
-
Constructor Details
-
RestResourceController
public RestResourceController()
-
-
Method Details
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceInitializingBean
-
findOne
@RequestMapping(method=GET, value="/{id:\\d+}") public HALResource<RestAddressableModel> findOne(@PathVariable String apiCategory, @PathVariable String model, @PathVariable Integer id) Called in GET is used to retrieve the single resource by identifier; Note that the regular expression in the request mapping accept a number as identifier; Please seefindOne(String, String, String)for findOne with string as identifier and seefindOne(String, String, UUID)for uuid as identifier- Parameters:
apiCategory- category from requestmodel- model from requestid- Identifier from request- Returns:
- single DSpaceResource
-
findOne
@RequestMapping(method=GET, value="/{id:^(?!^\\d+$)(?!^[0-9a-fxA-FX]{8}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{12}$)[\\w+\\-\\.:!]+$+}") public HALResource<RestAddressableModel> findOne(@PathVariable String apiCategory, @PathVariable String model, @PathVariable String id) Called in GET is used to retrieve the single resource by identifier; Note that the regular expression in the request mapping accept a string as identifier but not the other kind of identifier; http://<dspace.server.url>/api/{apiCategory}/{model}/{id} Example:
Please seehttp://<dspace.server.url>/api/config/submissionsections/collectionfindOne(String, String, Integer)for findOne with number as identifier and seefindOne(String, String, UUID)for uuid as identifier- Parameters:
apiCategory- category from requestmodel- model from requestid- Identifier from request- Returns:
- single DSpaceResource
-
findOne
@RequestMapping(method=GET, value="/{uuid:[0-9a-fxA-FX]{8}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{12}}") public HALResource<RestAddressableModel> findOne(@PathVariable String apiCategory, @PathVariable String model, @PathVariable UUID uuid) Called in GET is used to retrieve the single resource by identifier; Note that the regular expression in the request mapping accept a UUID as identifier; Please seefindOne(String, String, Integer)for findOne with number as identifier and seefindOne(String, String, String)for string as identifier- Parameters:
apiCategory- category from requestmodel- model from requestuuid- Identifier from request- Returns:
- single DSpaceResource
-
findRel
@RequestMapping(method=GET, value="/{id:\\d+}/{rel}") public org.springframework.hateoas.RepresentationModel findRel(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, @PathVariable String apiCategory, @PathVariable String model, @PathVariable Integer id, @PathVariable String rel, org.springframework.data.domain.Pageable page, org.springframework.data.web.PagedResourcesAssembler assembler) Called in GET is used to retrieve the relation resources; Note that the regular expression in the request mapping accept a number;- Parameters:
request- current HTTPServletRequestapiCategory- category from requestmodel- model from requestid- identifier from requestrel- relation from requestpage- pagination informationassembler- PagedResourcesAssembler- Returns:
- single RepresentationModel
-
findRel
@RequestMapping(method=GET, value="/{id:^(?!^\\d+$)(?!^[0-9a-fxA-FX]{8}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{12}$)[\\w+\\-\\.:!]+$+}/{rel}") public org.springframework.hateoas.RepresentationModel findRel(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, @PathVariable String apiCategory, @PathVariable String model, @PathVariable String id, @PathVariable String rel, org.springframework.data.domain.Pageable page, org.springframework.data.web.PagedResourcesAssembler assembler) Called in GET is used to retrieve the relation resources; Note that the regular expression in the request mapping accept a string as identifier but not the other kind of identifier;- Parameters:
request- current HTTPServletRequestresponse- HTTPServletResponseapiCategory- category from requestmodel- model from requestid- identifier from requestrel- relation from requestpage- pagination informationassembler- PagedResourcesAssembler- Returns:
- single RepresentationModel
-
findRel
@RequestMapping(method=GET, value="/{uuid:[0-9a-fxA-FX]{8}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{12}}/{rel}") public org.springframework.hateoas.RepresentationModel findRel(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, @PathVariable String apiCategory, @PathVariable String model, @PathVariable UUID uuid, @PathVariable String rel, org.springframework.data.domain.Pageable page, org.springframework.data.web.PagedResourcesAssembler assembler) Called in GET is used to retrieve the relation resources; Note that the regular expression in the request mapping accept a UUID as identifier;- Parameters:
request-apiCategory-model-uuid-rel-page-assembler-- Returns:
-
findRel
@RequestMapping(method=GET, value="/{id:^(?!^\\d+$)(?!^[0-9a-fxA-FX]{8}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{12}$)[\\w+\\-\\.:!]+$+}/{rel}/{relid}") public org.springframework.hateoas.RepresentationModel findRel(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, @PathVariable String apiCategory, @PathVariable String model, @PathVariable String id, @PathVariable String rel, @PathVariable String relid, org.springframework.data.domain.Pageable page, org.springframework.data.web.PagedResourcesAssembler assembler) throws Throwable Called in GET, try to retrieve the requested linked resource. Note that the regular expression in the request mapping accept a string as identifier but not the other kind of identifier; http://<dspace.server.url>/api/{apiCategory}/{model}/{id}/{rel}/{relid} Example:
Example:http://<dspace.server.url>/api/integration/authorities/SRJournalTitle/entryValues/1479-9995http://<dspace.server.url>/api/integration/authorities/srsc/entries/VR110111- Parameters:
request-apiCategory-model-id-rel-relid-page-assembler-- Returns:
- Throws:
Throwable
-
findRel
@RequestMapping(method=GET, value="/{id:\\d+}/{rel}/{relid}") public org.springframework.hateoas.RepresentationModel findRel(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, @PathVariable String apiCategory, @PathVariable String model, @PathVariable Integer id, @PathVariable String rel, @PathVariable String relid, org.springframework.data.domain.Pageable page, org.springframework.data.web.PagedResourcesAssembler assembler) throws Throwable - Throws:
Throwable
-
post
@RequestMapping(method=POST, value={"","/"}, consumes={"application/json","application/hal+json"}) public ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> post(jakarta.servlet.http.HttpServletRequest request, @PathVariable String apiCategory, @PathVariable String model, @RequestParam(required=false) String parent) throws HttpRequestMethodNotSupportedException Execute a POST request; curl -X POST -H "Content-Type:application/json" http://<dspace.server.url>/api/{apiCategory}/{model} Example:curl -X POST -H "Content-Type:application/json" http://<dspace.server.url>/api/submission/workspaceitems- Parameters:
request- The relevant requestapiCategory- The apiCategory to be usedmodel- The model to be usedparent- Optional parent identifier- Returns:
- The relevant ResponseEntity for this request
- Throws:
HttpRequestMethodNotSupportedException- If something goes wrong
-
postWithUriListContentType
@RequestMapping(method=POST, value={"","/"}, consumes="text/uri-list") public ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> postWithUriListContentType(jakarta.servlet.http.HttpServletRequest request, @PathVariable String apiCategory, @PathVariable String model) throws HttpRequestMethodNotSupportedException Execute a POST request; curl -X POST -H "Content-Type:text/uri-list" http://<dspace.server.url>/api/{apiCategory}/{model} Example:curl -X POST -H "Content-Type:text/uri-list" http://<dspace.server.url>/api/submission/workspaceitems- Parameters:
request- The relevant requestapiCategory- The apiCategory to be usedmodel- The model to be used- Returns:
- The relevant ResponseEntity for this request
- Throws:
HttpRequestMethodNotSupportedException- If something goes wrong
-
postJsonInternal
public <ID extends Serializable> ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> postJsonInternal(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, String parent) throws HttpRequestMethodNotSupportedException Internal method to execute POST with application/json MediaType;- Parameters:
request- The relevant requestapiCategory- The apiCategory to be usedmodel- The model to be usedparent- The parent object id (optional)- Returns:
- The relevant ResponseEntity for this request
- Throws:
HttpRequestMethodNotSupportedException- If something goes wrong
-
postUriListInternal
public <ID extends Serializable> ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> postUriListInternal(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model) throws HttpRequestMethodNotSupportedException Internal method to execute POST with text/uri-list MediaType;- Parameters:
request- The relevant requestapiCategory- The apiCategory to be usedmodel- The model to be used- Returns:
- The relevant ResponseEntity for this request
- Throws:
HttpRequestMethodNotSupportedException- If something goes wrong
-
action
@RequestMapping(method=POST, value="/{id:\\d+}", headers="content-type=application/x-www-form-urlencoded") public ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> action(jakarta.servlet.http.HttpServletRequest request, @PathVariable String apiCategory, @PathVariable String model, @PathVariable Integer id) throws HttpRequestMethodNotSupportedException, SQLException, IOException Called in POST, with a x-www-form-urlencoded, execute an action on a resource Note that the regular expression in the request mapping accept a number as identifier;- Parameters:
request-apiCategory-model-id-- Returns:
- Throws:
HttpRequestMethodNotSupportedExceptionIOExceptionSQLException
-
upload
@RequestMapping(method=POST, value="/{id:\\d+}", headers="content-type=multipart/form-data") public <ID extends Serializable> ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> upload(jakarta.servlet.http.HttpServletRequest request, @PathVariable String apiCategory, @PathVariable String model, @PathVariable Integer id, @RequestParam("file") MultipartFile uploadfile) throws HttpRequestMethodNotSupportedException Called in POST, multipart, upload to a specific rest resource the file passed as "file" request parameter Note that the regular expression in the request mapping accept a number as identifier;- Parameters:
request- the http requestapiCategory- the api categorymodel- the rest model that identify the REST resource collectionid- the id of the specific rest resourceuploadfile- the file to upload- Returns:
- the created resource
- Throws:
HttpRequestMethodNotSupportedException
-
upload
@RequestMapping(method=POST, value="/{uuid:[0-9a-fxA-FX]{8}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{12}}", headers="content-type=multipart/form-data") public <ID extends Serializable> ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> upload(jakarta.servlet.http.HttpServletRequest request, @PathVariable String apiCategory, @PathVariable String model, @PathVariable UUID uuid, @RequestParam("file") MultipartFile uploadfile) throws HttpRequestMethodNotSupportedException Called in POST, multipart, upload to a specific rest resource the file passed as "file" request parameter Note that the regular expression in the request mapping accept a UUID as identifier;- Parameters:
request- the http requestapiCategory- the api categorymodel- the rest model that identify the REST resource collectionuuid- the uuid of the specific rest resourceuploadfile- the file to upload- Returns:
- the created resource
- Throws:
HttpRequestMethodNotSupportedException
-
upload
@RequestMapping(method=POST, value="/{id:^(?!^\\d+$)(?!^[0-9a-fxA-FX]{8}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{12}$)[\\w+\\-\\.:!]+$+}", headers="content-type=multipart/form-data") public <ID extends Serializable> ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> upload(jakarta.servlet.http.HttpServletRequest request, @PathVariable String apiCategory, @PathVariable String model, @PathVariable String id, @RequestParam("file") MultipartFile uploadfile) throws HttpRequestMethodNotSupportedException Called in POST, multipart, upload to a specific rest resource the file passed as "file" request parameter Note that the regular expression in the request mapping accept a String as identifier;- Parameters:
request- the http requestapiCategory- the api categorymodel- the rest model that identify the REST resource collectionid- the id of the specific rest resourceuploadfile- the file to upload- Returns:
- the created resource
- Throws:
HttpRequestMethodNotSupportedException
-
upload
@RequestMapping(method=POST, value={"","/"}, headers="content-type=multipart/form-data") public <T extends RestAddressableModel> ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> upload(jakarta.servlet.http.HttpServletRequest request, @PathVariable String apiCategory, @PathVariable String model, @RequestParam("file") List<MultipartFile> uploadfile) throws SQLException, FileNotFoundException, IOException, AuthorizeException Upload a file against the collection resource endpoint. This is typically used for bulk creation of resources such for instance multiple workspaceitems from a CSV or bibliographic file- Parameters:
request- the http requestapiCategory- the api categorymodel- the rest model that identify the REST resource collectionuploadfile- the bulk file- Returns:
- the list of generated resources
- Throws:
SQLExceptionFileNotFoundExceptionIOExceptionAuthorizeException
-
patch
@RequestMapping(method=PATCH, value="/{id:\\d+}") public ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> patch(jakarta.servlet.http.HttpServletRequest request, @PathVariable String apiCategory, @PathVariable String model, @PathVariable Integer id, @RequestBody(required=true) com.fasterxml.jackson.databind.JsonNode jsonNode) PATCH method, using operation on the resources following (JSON) Patch notation (https://tools.ietf .org/html/rfc6902) Note that the regular expression in the request mapping accept a number as identifier;- Parameters:
request-apiCategory-model-id-jsonNode-- Returns:
- Throws:
HttpRequestMethodNotSupportedException
-
patch
@RequestMapping(method=PATCH, value="/{uuid:[0-9a-fxA-FX]{8}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{12}}") public ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> patch(jakarta.servlet.http.HttpServletRequest request, @PathVariable String apiCategory, @PathVariable String model, @PathVariable(name="uuid") UUID id, @RequestBody(required=true) com.fasterxml.jackson.databind.JsonNode jsonNode) PATCH method, using operation on the resources following (JSON) Patch notation (https://tools.ietf .org/html/rfc6902) Note that the regular expression in the request mapping accept a UUID as identifier;- Parameters:
request-apiCategory-model-id-jsonNode-- Returns:
- Throws:
HttpRequestMethodNotSupportedException
-
patch
@RequestMapping(method=PATCH, value="/{id:^(?!^\\d+$)(?!^[0-9a-fxA-FX]{8}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{12}$)[\\w+\\-\\.:!]+$+}") public ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> patch(jakarta.servlet.http.HttpServletRequest request, @PathVariable String apiCategory, @PathVariable String model, @PathVariable String id, @RequestBody(required=true) com.fasterxml.jackson.databind.JsonNode jsonNode) PATCH method, using operation on the resources following (JSON) Patch notation (https://tools.ietf .org/html/rfc6902) Note that the regular expression in the request mapping accept a UUID as identifier;- Parameters:
request-apiCategory-model-id-jsonNode-- Returns:
- Throws:
HttpRequestMethodNotSupportedException
-
patchInternal
public <ID extends Serializable> ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> patchInternal(jakarta.servlet.http.HttpServletRequest request, String apiCategory, String model, ID id, com.fasterxml.jackson.databind.JsonNode jsonNode) Internal patch method- Parameters:
request-apiCategory-model-id-jsonNode-- Returns:
- Throws:
HttpRequestMethodNotSupportedException
-
findAll
@RequestMapping(method=GET, value={"","/"}) public <T extends RestAddressableModel> org.springframework.hateoas.PagedModel<DSpaceResource<T>> findAll(@PathVariable String apiCategory, @PathVariable String model, org.springframework.data.domain.Pageable page, org.springframework.data.web.PagedResourcesAssembler assembler, jakarta.servlet.http.HttpServletResponse response, @RequestParam MultiValueMap<String, Object> parameters) Find all via a GET request to the root endpoint. This method will trigger in cases where the called endpoint either includes a trailing slash or not.- Parameters:
apiCategory-model-page-assembler-- Returns:
-
listSearchMethods
@RequestMapping(method=GET, value="/search") public org.springframework.hateoas.RepresentationModel listSearchMethods(@PathVariable String apiCategory, @PathVariable String model) -
executeSearchMethods
@RequestMapping(method=GET, value="/search/{searchMethodName}") public <T extends RestAddressableModel> org.springframework.hateoas.RepresentationModel executeSearchMethods(@PathVariable String apiCategory, @PathVariable String model, @PathVariable String searchMethodName, jakarta.servlet.http.HttpServletResponse response, org.springframework.data.domain.Pageable pageable, org.springframework.data.domain.Sort sort, org.springframework.data.web.PagedResourcesAssembler assembler, @RequestParam MultiValueMap<String, Object> parameters) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException -
delete
@RequestMapping(method=DELETE, value="/{id:\\d+}") public ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> delete(jakarta.servlet.http.HttpServletRequest request, @PathVariable String apiCategory, @PathVariable String model, @PathVariable Integer id) throws HttpRequestMethodNotSupportedException Method to delete an entity by ID Note that the regular expression in the request mapping accept a number as identifier;- Parameters:
request-apiCategory-model-id-- Returns:
- Throws:
HttpRequestMethodNotSupportedException
-
delete
@RequestMapping(method=DELETE, value="/{uuid:[0-9a-fxA-FX]{8}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{12}}") public ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> delete(jakarta.servlet.http.HttpServletRequest request, @PathVariable String apiCategory, @PathVariable String model, @PathVariable UUID uuid) throws HttpRequestMethodNotSupportedException -
delete
@RequestMapping(method=DELETE, value="/{id:^(?!^\\d+$)(?!^[0-9a-fxA-FX]{8}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{12}$)[\\w+\\-\\.:!]+$+}") public ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> delete(jakarta.servlet.http.HttpServletRequest request, @PathVariable String apiCategory, @PathVariable String model, @PathVariable String id) throws HttpRequestMethodNotSupportedException -
put
@RequestMapping(method=PUT, value="/{uuid:[0-9a-fxA-FX]{8}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{12}}") public DSpaceResource<RestAddressableModel> put(jakarta.servlet.http.HttpServletRequest request, @PathVariable String apiCategory, @PathVariable String model, @PathVariable UUID uuid, @RequestBody com.fasterxml.jackson.databind.JsonNode jsonNode) Execute a PUT request for an entity with id of type UUID; curl -X PUT http://<dspace.server.url>/api/{apiCategory}/{model}/{uuid} Example:curl -X PUT http://<dspace.server.url>/api/core/collection/8b632938-77c2-487c-81f0-e804f63e68e6- Parameters:
request- the http requestapiCategory- the API category e.g. "core"model- the DSpace model e.g. "collection"uuid- the ID of the target REST objectjsonNode- the part of the request body representing the updated rest object- Returns:
- the relevant REST resource
-
put
@RequestMapping(method=PUT, value="/{id:\\d+}", consumes={"application/json","application/hal+json"}) public DSpaceResource<RestAddressableModel> put(jakarta.servlet.http.HttpServletRequest request, @PathVariable String apiCategory, @PathVariable String model, @PathVariable Integer id, @RequestBody(required=true) com.fasterxml.jackson.databind.JsonNode jsonNode) Execute a PUT request for an entity with id of type Integer; curl -X PUT -H "Content-Type:application/json" http://<dspace.server.url>/api/{apiCategory}/{model}/{id} Example:curl -X PUT -H "Content-Type:application/json" http://<dspace.server.url>/api/core/metadatafield/1- Parameters:
request- the http requestapiCategory- the API category e.g. "api"model- the DSpace model e.g. "collection"id- the ID of the target REST objectjsonNode- the part of the request body representing the updated rest object- Returns:
- the relevant REST resource
-
put
@RequestMapping(method=PUT, value="/{id:\\d+}", consumes="text/uri-list") public DSpaceResource<RestAddressableModel> put(jakarta.servlet.http.HttpServletRequest request, @PathVariable String apiCategory, @PathVariable String model, @PathVariable Integer id) throws IOException Execute a PUT request for an entity with id of type Integer; curl -X PUT -H "Content-Type:text/uri-list" http://<dspace.server.url>/api/{apiCategory}/{model}/{id} Example:curl -X PUT -H "Content-Type:text/uri-list" http://<dspace.server.url>/api/core/metadatafield/1- Parameters:
request- the http requestapiCategory- the API category e.g. "api"model- the DSpace model e.g. "collection"id- the ID of the target REST object- Returns:
- the relevant REST resource
- Throws:
IOException
-
put
@RequestMapping(method=PUT, value="/{id:[0-9a-fA-F]{32}}", consumes={"application/json","application/hal+json"}) public DSpaceResource<RestAddressableModel> put(jakarta.servlet.http.HttpServletRequest request, @PathVariable String apiCategory, @PathVariable String model, @PathVariable String id, @RequestBody(required=true) com.fasterxml.jackson.databind.JsonNode jsonNode) Execute a PUT request for an entity with id of type String and containing 32 hexadecimal digits.curl -X PUT -H "Content-Type:application/json" http://<dspace.server.url>/api/{apiCategory}/{model}/{id}
Example:
curl -X PUT -H "Content-Type:application/json" http://<dspace.server.url>/api/core/metadatafield/d41d8cd98f00b204e9800998ecf8427e- Parameters:
request- the http requestapiCategory- the API category e.g. "api"model- the DSpace model e.g. "collection"id- the ID of the target REST objectjsonNode- the part of the request body representing the updated rest object- Returns:
- the relevant REST resource
-