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 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 modified
      jsonNode - The data as shown above
      Returns:
      The modified item
      Throws:
      SQLException
      AuthorizeException
    • 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:
      SQLException
      AuthorizeException
      IOException