Skip to content

Introduce File API

Create an API for registering files and their fixity values to a Bag. This can be started once changes from #101 (closed) are complete.

Short and sweet version:

  • POST /api/bags/<bag_id>/file
    • Description: Create a BagFile resource for a specified Bag
    • RequestBody: FileCreate
    • 201 - file created successfully
    • 400 - bag_id doesn't exist or RequestBody is invalid
    • 403 - user is not authorized to update the specified Bag
    • 409 - a file with the same filename already exists
    • Test
  • POST /api/bags/<bag_id>/files
    • Description: Upload a csv containing multiple files for a Bag
    • RequestBody: MultipartFile upload
    • tbd - status on success (202? DeferredResult? Async?)
    • 400 - the csv uploaded is invalid
    • 403 - user is not authorized to update the specified Bag
    • 409 - a csv is already being processed for a bag_id
    • 500 - an error happened while processing the csv
    • Test
  • PUT /api/bags/<bag_id>/file/<file_id>/fixity
    • Description: Create a Fixity resource for a given File
    • RequestBody: FixityCreate
    • 201 - fixity created successfully
    • 400 - bag_id | file_id does not exist or RequestBody is invalid
    • 403 - user is not authorized to update the specified Bag
    • 409 - a fixity with the given algorithm already exists
    • Test
  • GET /api/files
    • Description: Query all Files
    • RequestParams: {bag: Long, size: Long, fixity: String, algorithm: String, filename: String, createdBefore: ZonedDateTime, createdAfter: ZonedDateTime, updatedBefore: ZonedDateTime, updatedAfter: ZonedDateTime}
    • 200 - all files
    • Test
  • GET /api/files/<file_id>
    • Description: Retrieve a file by its id
    • 200 - the specified file
    • 404 - file with the given id does not exist
    • Test
  • GET /api/bags/<bag_id>/files
    • Description: Query all Files for a given Bag
    • RequestParams: {size: Long, fixity: String, algorithm: String, filename: String, createdBefore: ZonedDateTime, createdAfter: ZonedDateTime, updatedBefore: ZonedDateTime, updatedAfter: ZonedDateTime}
    • 200 - all files belonging to a bag
    • 400 - bag_id does not exist
    • Test
  • GET /api/bags/<bag_id>/files/<file_id>
    • Description: Retrieve a file by its id for a Bag
    • 200 - the specified file
    • 400 - bag_id does not exist
    • 404 - file_id does not exist or is not in the given Bag
    • Test
  • GET /api/bags/<bag_id>/files/<file_id>/fixity
    • Description: Retrieve all Fixities for a given File
    • 200 - all fixities for a given file
    • 400 - bag_id | file_id does not exist
    • Test
  • GET /api/bags/<bag_id>/file/<file_id>/fixity/<algorithm>
    • Description: Retrieve a Fixity by its algorithm for a File
    • 200 - fixity belonging to the given file exists
    • 400 - bag_id | file_id does not exist
    • 404 - no fixity with the specified algorithm exists
    • Test
  • #113 (closed) Client for File API
Edited by Ghost User