列出数据库
列出已认证 Glue 用户可用的数据库。
认证
需要 X-Glue-Authentication。
HTTP 请求
curl -X GET "https://api.hola.cloud/v1/databases" \
-H "X-Glue-Authentication: your-glue-token"GET /v1/databases HTTP/1.1
Host: api.hola.cloud
X-Glue-Authentication: your-glue-token
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, err := http.NewRequest("GET", "https://api.hola.cloud/v1/databases", nil)
if err != nil {
panic(err)
}
req.Header.Set("X-Glue-Authentication", "your-glue-token")
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/databases',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => [
'X-Glue-Authentication: your-glue-token',
],
]);
$response = curl_exec($ch);
if ($response === false) {
throw new Exception(curl_error($ch));
}
curl_close($ch);
echo $response;
import requests
headers = {
"X-Glue-Authentication": "your-glue-token",
}
response = requests.request(
"GET",
"https://api.hola.cloud/v1/databases",
headers=headers
)
print(response.text)
const response = await fetch("https://api.hola.cloud/v1/databases", {
method: "GET",
headers: {
"X-Glue-Authentication": "your-glue-token"
}
});
console.log(await response.text());
const response = await fetch("https://api.hola.cloud/v1/databases", {
method: "GET",
headers: {
"X-Glue-Authentication": "your-glue-token"
}
});
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/databases"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.header("X-Glue-Authentication", "your-glue-token")
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}响应
1[
2 {
3 "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
4 "name": "production-db",
5 "creation_date": "2025-06-15T10:30:00Z",
6 "owners_length": 1
7 }
8]
评论