Package org.dspace.app.rest
Class MappedCollectionRestController
java.lang.Object
org.dspace.app.rest.MappedCollectionRestController
@RestController
@RequestMapping("/api/core/items/{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}}/mappedCollections")
public class MappedCollectionRestController
extends Object
This RestController takes care of the creation and deletion of MappedCollections.
This class will typically receive a UUID that resolves to an Item and it'll perform logic on its collections
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateCollectionToItemRelation(UUID uuid, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.http.HttpServletRequest request) This method will add an Item to a Collection.voiddeleteCollectionToItemRelation(UUID uuid, UUID collectionUuid, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.http.HttpServletRequest request) This method will delete a Collection to Item relation.
-
Constructor Details
-
MappedCollectionRestController
public MappedCollectionRestController()
-
-
Method Details
-
createCollectionToItemRelation
@RequestMapping(method=POST, consumes="text/uri-list") @ResponseStatus(NO_CONTENT) public void createCollectionToItemRelation(@PathVariable UUID uuid, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.http.HttpServletRequest request) throws SQLException, AuthorizeException This method will add an Item to a Collection. The Collection object is encapsulated in the request due to the text/uri-list consumer and the Item UUID comes from the path in the URL curl -X POST http://<dspace.server.url>/api/core/item/{uuid}/mappedCollections -H "Content-Type:text/uri-list" --data $'https://{url}/rest/api/core/collections/{uuid}' Example:curl -X POST http://<dspace.server.url>/api/core/item/{uuid}/mappedCollections -H "Content-Type:text/uri-list" --data $'https://{url}/rest/api/core/collections/506a7e54-8d7c-4d5b-8636-d5f6411483de'- Parameters:
uuid- The UUID of the Item that'll be added to a collectionresponse- The HttpServletResponserequest- The HttpServletRequest that will contain the UUID of the Collection in its body- Throws:
SQLException- If something goes wrongAuthorizeException- If something goes wrong
-
deleteCollectionToItemRelation
@RequestMapping(method=DELETE, value="/{collectionUuid}") @ResponseStatus(NO_CONTENT) public void deleteCollectionToItemRelation(@PathVariable UUID uuid, @PathVariable UUID collectionUuid, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.http.HttpServletRequest request) throws SQLException, AuthorizeException, IOException This method will delete a Collection to Item relation. It will remove an Item with UUID given in the request URL from the Collection with UUID given in the request URL. curl -X DELETE http://<dspace.server.url>/api/core/item/{uuid}/mappedCollections/{collectionUuid} Example:curl -X DELETE http://<dspace.server.url>/api/core/item/{uuid}/mappedCollections/{collectionUuid}- Parameters:
uuid- The UUID of the ItemcollectionUuid- The UUID of the Collectionresponse- The HttpServletReponserequest- The HttpServletRequest- Throws:
SQLException- If something goes wrongAuthorizeException- If something goes wrongIOException- If something goes wrong
-