List Files
List files in a bucket. The path after /list/ is used as a prefix filter.
Authentication
Requires X-Glue-Authentication.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
bucket_id |
string | The bucket ID |
* |
string | Prefix filter |
Request
curl "https://api.hola.cloud/v1/buckets/bucket-550e8400-e29b-41d4-a716-446655440000/list/images/" \
-H 'X-Glue-Authentication: {"user":{"id":"user-123"}}'GET /v1/buckets/bucket-550e8400-e29b-41d4-a716-446655440000/list/images/ HTTP/1.1
Host: api.hola.cloud
X-Glue-Authentication: {"user":{"id":"user-123"}}
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, err := http.NewRequest("GET", "https://api.hola.cloud/v1/buckets/bucket-550e8400-e29b-41d4-a716-446655440000/list/images/", nil)
if err != nil {
panic(err)
}
req.Header.Set("X-Glue-Authentication", "{\"user\":{\"id\":\"user-123\"}}")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
responseBody, err := io.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println(string(responseBody))
}
<?php
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://api.hola.cloud/v1/buckets/bucket-550e8400-e29b-41d4-a716-446655440000/list/images/',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => [
'X-Glue-Authentication: {"user":{"id":"user-123"}}',
],
]);
$response = curl_exec($ch);
if ($response === false) {
throw new Exception(curl_error($ch));
}
curl_close($ch);
echo $response;
import requests
headers = {
"X-Glue-Authentication": "{\"user\":{\"id\":\"user-123\"}}",
}
response = requests.request(
"GET",
"https://api.hola.cloud/v1/buckets/bucket-550e8400-e29b-41d4-a716-446655440000/list/images/",
headers=headers
)
print(response.text)
const response = await fetch("https://api.hola.cloud/v1/buckets/bucket-550e8400-e29b-41d4-a716-446655440000/list/images/", {
method: "GET",
headers: {
"X-Glue-Authentication": "{\"user\":{\"id\":\"user-123\"}}"
}
});
console.log(await response.text());
const response = await fetch("https://api.hola.cloud/v1/buckets/bucket-550e8400-e29b-41d4-a716-446655440000/list/images/", {
method: "GET",
headers: {
"X-Glue-Authentication": "{\"user\":{\"id\":\"user-123\"}}"
}
});
const text = await response.text();
console.log(text);
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.hola.cloud/v1/buckets/bucket-550e8400-e29b-41d4-a716-446655440000/list/images/"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.header("X-Glue-Authentication", "{\"user\":{\"id\":\"user-123\"}}")
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}Response
The response is a JSON array.
1[
2 {
3 "id": "file-9f0b7b3c-1d2e-4a5f-8b9c-0123456789ab",
4 "name": "images/logo.png",
5 "bucket": "bucket-550e8400-e29b-41d4-a716-446655440000",
6 "created_timestamp": 1782045660000000000,
7 "updated_timestamp": 1782045660000000000,
8 "size": 24576,
9 "mime_type": "image/png",
10 "hash_md5": "example-md5",
11 "hash_sha256": "example-sha256",
12 "status": "available",
13 "owners": ["user-123"]
14 }
15]
Error Codes
| Status | Description |
|---|---|
| 401 | Missing or invalid X-Glue-Authentication |
| 500 | Persistence error |
Comments