设置键

设置集合中键的值。路径中的通配符 * 将被替换为键名。

身份验证

需要内部身份验证。通过 X-Glue-Authentication 头部或 apikeysecret 头部传递凭据。

路径参数

参数 类型 描述
col string 集合名称

请求体

字段 类型 描述
value any 要存储的 JSON 值
1{
2  "value": {
3    "name": "Alice",
4    "email": "alice@example.com",
5    "role": "admin"
6  }
7}

请求示例

 1curl -X POST "https://api.hola.cloud/v1/collections/users/keys/user:1001" \
 2  -H "X-Glue-Authentication: YOUR_AUTH_TOKEN" \
 3  -H "Content-Type: application/json" \
 4  -d '{
 5    "value": {
 6      "name": "Alice",
 7      "email": "alice@example.com",
 8      "role": "admin"
 9    }
10  }'

响应示例

1HTTP/1.1 200 OK
2Content-Type: application/json
1 {
2  "ok": true,
3  "seq": 1,
4  "version": 1
5}

错误代码

状态 代码 描述
400 invalid_json 缺少或无效的值
403 forbidden Missing authentication headers
404 not_found 未找到集合
500 internal_error 服务器内部错误

评论

发表评论