删除键
从集合中删除一个键。路径中的通配符 * 将被替换为键名。
身份验证
需要内部身份验证。通过 X-Glue-Authentication 头部或 apikey 和 secret 头部传递凭据。
路径参数
| 参数 | 类型 | 描述 |
|---|---|---|
| col | string | 集合名称 |
请求示例
curl -X DELETE "https://api.hola.cloud/v1/collections/users/keys/user:1001" \
-H "X-Glue-Authentication: YOUR_AUTH_TOKEN"DELETE /v1/collections/users/keys/user:1001 HTTP/1.1
Host: api.hola.cloud
X-Glue-Authentication: YOUR_AUTH_TOKEN
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, err := http.NewRequest("DELETE", "https://api.hola.cloud/v1/collections/users/keys/user:1001", nil)
if err != nil {
panic(err)
}
req.Header.Set("X-Glue-Authentication", "YOUR_AUTH_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/collections/users/keys/user:1001',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_HTTPHEADER => [
'X-Glue-Authentication: YOUR_AUTH_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_AUTH_TOKEN",
}
response = requests.request(
"DELETE",
"https://api.hola.cloud/v1/collections/users/keys/user:1001",
headers=headers
)
print(response.text)
const response = await fetch("https://api.hola.cloud/v1/collections/users/keys/user:1001", {
method: "DELETE",
headers: {
"X-Glue-Authentication": "YOUR_AUTH_TOKEN"
}
});
console.log(await response.text());
const response = await fetch("https://api.hola.cloud/v1/collections/users/keys/user:1001", {
method: "DELETE",
headers: {
"X-Glue-Authentication": "YOUR_AUTH_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/collections/users/keys/user:1001"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.header("X-Glue-Authentication", "YOUR_AUTH_TOKEN")
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}响应示例
1HTTP/1.1 200 OK
2Content-Type: application/json
1{
2 "ok": true,
3 "seq": 2,
4 "version": 2
5}
错误代码
| 状态 | 代码 | 描述 |
|---|---|---|
| 403 | forbidden | Missing authentication headers |
| 404 | not_found | 未找到集合或键 |
| 500 | internal_error | 服务器内部错误 |
评论