Web service reads from S3 interface
Closed this issue · 2 comments
Reviewer: Rob, Dan
A POST request to the Web API (route "listpresent", JSON body) returns a list of the files already present at the server end.
#16
Acceptance criteria:
Both the web app and the S3 interface need to be up and running.
POST request to http://172.28.129.160:8888/listpresent/ with correctly formatted JSON body (e.g. http://172.28.129.160:8888/listpresent/ {"bucket": "test-bucket-name", "directory": "testdir/testsubdir"}
) returns a JSON response
The relative path to directory is an optional argument ({"bucket": "test-bucket-name"}
should also work). When it is absent all files should be returned.
- When the bucket does not exist a warning message should be returned
- When there are no files in the directory at the S3 end this should return an empty array
- When there are files in the directory at the S3 end this should return information for each one: name (including relative path), which bucket it is in, size in bytes, last modified (in UNIX time)
Note #71 will fix a status and status code issue
Warning is returned by a non-existent bucket ✔️
An empty array is returned from an empty bucket ✔️
When there are files then it returns information like this:
"objects": [
{
"object_name": "2test2/333testing/444testing/555testing/test.txt",
"bucket_name": "ditto-anything-i-want",
"is_dir": false,
"size": 5,
"etag": "\"d8e8fca2dc0f896fd7cb4cb0031ba249\"",
"last modified": 1543511480.145
}
]
This only lists files and not folders so "is_dir" is always false - is this expected?
"is_dir"
has now been removed which resolves the previous comment