Package org.dspace.app.rest
Class BundleUploadBitstreamController
java.lang.Object
org.dspace.app.rest.BundleUploadBitstreamController
@RestController
@RequestMapping("/api/core/bundles/{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}}/bitstreams")
public class BundleUploadBitstreamController
extends Object
Controller to upload bitstreams to a certain bundle, indicated by a uuid in the request
Usage: POST /api/core/bundles/{uuid}/bitstreams (with file and properties of file in request)
Example:
curl https://<dspace.server.url>/api/core/bundles/d3599177-0408-403b-9f8d-d300edd79edb/bitstreams
-XPOST -H 'Content-Type: multipart/form-data' \
-H 'Authorization: Bearer eyJhbGciOiJI...' \
-F "file=@Downloads/test.html" \
-F 'properties={ "name": "test.html", "metadata": { "dc.description": [ { "value": "example file", "language": null,
"authority": null, "confidence": -1, "place": 0 } ]}, "bundleName": "ORIGINAL" };type=application/json'
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionResponseEntity<org.springframework.hateoas.RepresentationModel<?>>uploadBitstream(jakarta.servlet.http.HttpServletRequest request, UUID uuid, MultipartFile uploadfile, String properties) Method to upload a Bitstream to a Bundle with the given UUID in the URL.
-
Field Details
-
utils
-
-
Constructor Details
-
BundleUploadBitstreamController
public BundleUploadBitstreamController()
-
-
Method Details
-
uploadBitstream
@RequestMapping(method=POST, headers="content-type=multipart/form-data") @PreAuthorize("hasPermission(#uuid, \'BUNDLE\', \'ADD\') && hasPermission(#uuid, \'BUNDLE\', \'WRITE\')") public ResponseEntity<org.springframework.hateoas.RepresentationModel<?>> uploadBitstream(jakarta.servlet.http.HttpServletRequest request, @PathVariable UUID uuid, @RequestParam("file") MultipartFile uploadfile, @RequestParam(value="properties",required=false) String properties) Method to upload a Bitstream to a Bundle with the given UUID in the URL. This will create a Bitstream with the file provided in the request and attach this to the Item that matches the UUID in the URL. This will only work for uploading one file, any extra files will silently be ignored- Returns:
- The created BitstreamResource
-