Package org.dspace.app.rest
Class ItemTemplateRestController
java.lang.Object
org.dspace.app.rest.ItemTemplateRestController
@RestController
@RequestMapping("/api/core/itemtemplates/{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 class ItemTemplateRestController
extends Object
This RestController takes care of the modification and retrieval of Collection's Item templates
Contrary to CollectionItemtemplateController, this class will receive the UUID of an Item template
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionResponseEntity<org.springframework.hateoas.RepresentationModel<?>>deleteTemplateItem(jakarta.servlet.http.HttpServletRequest request, UUID uuid) This method deletes a template item from a collection.getTemplateItem(jakarta.servlet.http.HttpServletRequest request, UUID uuid) This method gets a template Item based on its uuid Example:ResponseEntity<org.springframework.hateoas.RepresentationModel<?>>patch(jakarta.servlet.http.HttpServletRequest request, UUID uuid, com.fasterxml.jackson.databind.JsonNode jsonNode) This method modifies installed template items Example:
-
Constructor Details
-
ItemTemplateRestController
public ItemTemplateRestController()
-
-
Method Details
-
getTemplateItem
@PreAuthorize("hasPermission(#uuid, \'COLLECTION\', \'READ\')") @RequestMapping(method=GET) public TemplateItemResource getTemplateItem(jakarta.servlet.http.HttpServletRequest request, @PathVariable UUID uuid) This method gets a template Item based on its uuid Example:curl http://<dspace.server.url>/api/core/itemtemplates/cb760455-837a-4159-bd12-dcdfafcadc78 -XGET \ -H 'Authorization: Bearer eyJhbGciOiJI...'- Parameters:
request-uuid- A UUID of a template item- Returns:
- The template item corresponding to the UUID above
-
patch
@PreAuthorize("hasPermission(#uuid, \'ITEMTEMPLATE\', \'WRITE\')") @RequestMapping(method=PATCH) public ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> patch(jakarta.servlet.http.HttpServletRequest request, @PathVariable UUID uuid, @RequestBody(required=true) com.fasterxml.jackson.databind.JsonNode jsonNode) throws SQLException, AuthorizeException This method modifies installed template items Example:curl http://<dspace.server.url>/api/core/itemtemplates/cb760455-837a-4159-bd12-dcdfafcadc78 -XPATCH -H 'Content-Type: Content-Type:application/json' \ -H 'Authorization: Bearer eyJhbGciOiJI...' \ --data '[ { "op": "add", "path": "/metadata/dc.description", "value": [ { "value": "Some other first description" } ] } ]'- Parameters:
request-uuid- The UUID of the template item to be modifiedjsonNode- The data as shown above- Returns:
- The modified item
- Throws:
SQLExceptionAuthorizeException
-
deleteTemplateItem
@PreAuthorize("hasPermission(#uuid, \'ITEMTEMPLATE\', \'DELETE\')") @RequestMapping(method=DELETE) public ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> deleteTemplateItem(jakarta.servlet.http.HttpServletRequest request, @PathVariable UUID uuid) throws SQLException, AuthorizeException, IOException This method deletes a template item from a collection. Example:curl http://<dspace.server.url>/api/core/itemtemplates/cb760455-837a-4159-bd12-dcdfafcadc78 -XDELETE \ -H 'Authorization: Bearer eyJhbGciOiJI...'- Parameters:
request-uuid-- Returns:
- Status code 204 is returned if the deletion was successful
- Throws:
SQLExceptionAuthorizeExceptionIOException
-