Upload a File
This method can handle two different calls, one where a file path is passed, and a second where it does not receive a , and it means we are going to use the MD5 of the file as the file name.
Using file name:
URL: > files/{bucketname}/{path:.*}
HTTP Method: PUT
Response: if the file was uploaded, returns:
{
"bucket": "<bucket name>",
"objectName": "<file name>",
"parentPath": "<file path>",
"checksum": "<MD5 checksum>",
"size": <file size>
}
``
Example
```text
curl -X PUT -T ~/Downloads/image1.jpg PUT http:localhost:8080/files/bucket1/folder1/folder2/image.jpg
``
Response:
```json
{
"bucket": "bucket1",
"objectName": "image.jpg",
"parentPath": "/folder1/folder2/",
"checksum": "86af350cbceb14672fdcaee11bc2571a",
"size": 66779
}
Without file name:
URL: > files/{bucketname}/{path:.*}
HTTP Method: PUT
Response: if the file was uploaded, returns:
{
"bucket": "<bucket name>",
"objectName": "<MD5 checksum>",
"parentPath": "/",
"checksum": "<MD5 checksum>",
"size": <file size>
}
Example:
curl -X PUT -T ~/Downloads/image1.jpg PUT http:localhost:8080/files/bucket1
Response:
{
"bucket": "bucket1",
"objectName": "86af350cbceb14672fdcaee11bc2571a",
"parentPath": "/",
"checksum": "86af350cbceb14672fdcaee11bc2571a",
"size": 66779
}
Get a File
http://localhost:8080/files/<bucketName>/folder1/folder2/test.deb
Delete a file
DELETE
http://localhost:8080/files/<bucketName>/{path:.*}
HEADER:
Bucket: <bucketName>
Example:
curl --location --request DELETE 'http://localhost:8080/files/my-bucket/folder1/folder2/test.deb' \
--header 'Bucket: <bucketName>'
List Files
This method list all the file names under a bucket and parent path (folder)
Example 1:
curl -X GET http:localhost:8080/files/my-bucket/my-folder
Example 2:
curl -X GET http:localhost:8080/files/my-bucket
Response:
{
"files": [
"diesel.jpg", "LOTR.pdf"
]
}
App Ready
Check if the app is ready:
curl -v -X GET "http://localhost:8080/appReady"
Last updated
Was this helpful?