Getting Started
This guide walks through creating a bucket, uploading a file, listing files, downloading, and deleting.
Prerequisites
curlinstalled locally- A valid
X-Glue-Authenticationheader for the authenticated user
1X-Glue-Authentication: {"user":{"id":"user-123"}}
All requests use https://api.hola.cloud.
Step 1: Create a Bucket
1curl -X POST "https://api.hola.cloud/v1/buckets" \
2 -H 'X-Glue-Authentication: {"user":{"id":"user-123"}}' \
3 -H "Content-Type: application/json" \
4 -d '{
5 "name": "my-first-bucket",
6 "description": "First test bucket"
7 }'
Expected response:
1{
2 "id": "bucket-550e8400-e29b-41d4-a716-446655440000",
3 "project_id": "",
4 "created_timestamp": 1782045600000000000,
5 "owners": ["user-123"],
6 "name": "my-first-bucket",
7 "description": "First test bucket"
8}
Step 2: Upload a File
1curl -X PUT "https://api.hola.cloud/v1/buckets/bucket-550e8400-e29b-41d4-a716-446655440000/files/hello.txt" \
2 -H 'X-Glue-Authentication: {"user":{"id":"user-123"}}' \
3 -H "Content-Type: text/plain" \
4 --data-binary "Hello, HolaCloud Files!"
Expected response:
1{
2 "id": "file-9f0b7b3c-1d2e-4a5f-8b9c-0123456789ab",
3 "uuid": "9f0b7b3c-1d2e-4a5f-8b9c-0123456789ab",
4 "created_timestamp": 1782045660000000000,
5 "updated_timestamp": 1782045660000000000,
6 "owners": ["user-123"],
7 "status": "available",
8 "size": 23,
9 "name": "hello.txt",
10 "bucket": "bucket-550e8400-e29b-41d4-a716-446655440000",
11 "hash_md5": "example-md5",
12 "hash_sha256": "example-sha256",
13 "mime_type": "text/plain; charset=utf-8"
14}
Step 3: List Files
1curl "https://api.hola.cloud/v1/buckets/bucket-550e8400-e29b-41d4-a716-446655440000/list/*" \
2 -H 'X-Glue-Authentication: {"user":{"id":"user-123"}}'
Expected response:
1[
2 {
3 "id": "file-9f0b7b3c-1d2e-4a5f-8b9c-0123456789ab",
4 "name": "hello.txt",
5 "bucket": "bucket-550e8400-e29b-41d4-a716-446655440000",
6 "created_timestamp": 1782045660000000000,
7 "updated_timestamp": 1782045660000000000,
8 "size": 23,
9 "mime_type": "text/plain; charset=utf-8",
10 "hash_md5": "example-md5",
11 "hash_sha256": "example-sha256",
12 "status": "available",
13 "owners": ["user-123"]
14 }
15]
Step 4: Download the File
1curl "https://api.hola.cloud/v1/buckets/bucket-550e8400-e29b-41d4-a716-446655440000/files/hello.txt" \
2 -H 'X-Glue-Authentication: {"user":{"id":"user-123"}}'
Step 5: Delete the File
1curl -X DELETE "https://api.hola.cloud/v1/buckets/bucket-550e8400-e29b-41d4-a716-446655440000/files/hello.txt" \
2 -H 'X-Glue-Authentication: {"user":{"id":"user-123"}}'
Step 6: Delete the Bucket
1curl -X DELETE "https://api.hola.cloud/v1/buckets/bucket-550e8400-e29b-41d4-a716-446655440000" \
2 -H 'X-Glue-Authentication: {"user":{"id":"user-123"}}'
Comments