凭据
更新凭据
通过 OMA API 更新凭据。
POST
/
v1
/
vaults
/
{vault_id}
/
credentials
/
{credential_id}
更新凭据
curl --request POST \
--url http://localhost:38080/v1/vaults/{vault_id}/credentials/{credential_id} \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '{}'import requests
url = "http://localhost:38080/v1/vaults/{vault_id}/credentials/{credential_id}"
payload = {}
headers = {
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('http://localhost:38080/v1/vaults/{vault_id}/credentials/{credential_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:38080/v1/vaults/{vault_id}/credentials/{credential_id}"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Api-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"type": "vault_credential",
"id": "vcrd_011CZkZEMt8gZan2iYOQfSkw",
"vault_id": "vlt_011CZkZDLs7fYzm1hXNPeRjv",
"display_name": "示例凭证",
"metadata": {
"environment": "production"
},
"created_at": "2026-03-15T10:00:00Z",
"updated_at": "2026-03-15T10:00:00Z",
"archived_at": null,
"auth": {
"type": "static_bearer",
"mcp_server_url": "https://example-server.modelcontextprotocol.io/sse"
}
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}每个请求都必须发送
?beta=true。授权
omaApiKeyomaBearer
OMA 工作区 API 密钥。
查询参数
为此接口启用 Beta API 合同,必须为 true。
可用选项:
true 请求体
application/json
凭据更新后的可读名称。1-255 个字符。
Required string length:
1 - 255示例:
"示例凭证"
元数据补丁。将某个键设为字符串可插入或更新该键,设为 null 可删除该键。省略的键保持不变。
Show child attributes
Show child attributes
示例:
{ "environment": "production" }
更新后的认证配置。type 不可变;发送的变体必须与已存储 credential 的类型匹配。
- Option 1
- Option 2
- Option 3
Show child attributes
Show child attributes
响应
请求成功。
存储在密钥库中的凭据。敏感字段永远不会在响应中返回。
可用选项:
vault_credential 示例:
"vault_credential"
凭据的唯一标识符。
示例:
"vcrd_011CZkZEMt8gZan2iYOQfSkw"
该 credential 所属密钥库的标识符。
示例:
"vlt_011CZkZDLs7fYzm1hXNPeRjv"
附加到该凭证的任意键值元数据。
Show child attributes
Show child attributes
示例:
{ "environment": "production" }
RFC 3339 格式的时间戳
示例:
"2026-03-15T10:00:00Z"
RFC 3339 格式的时间戳
示例:
"2026-03-15T10:00:00Z"
凭证的归档时间。未归档时为 null。
示例:
null
此 credential 的认证配置。
- Option 1
- Option 2
- Option 3
Show child attributes
Show child attributes
示例:
{
"type": "static_bearer",
"mcp_server_url": "https://example-server.modelcontextprotocol.io/sse"
}
凭据的人类可读名称。
示例:
"示例凭证"
此页面对您有帮助吗?
⌘I
更新凭据
curl --request POST \
--url http://localhost:38080/v1/vaults/{vault_id}/credentials/{credential_id} \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '{}'import requests
url = "http://localhost:38080/v1/vaults/{vault_id}/credentials/{credential_id}"
payload = {}
headers = {
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('http://localhost:38080/v1/vaults/{vault_id}/credentials/{credential_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:38080/v1/vaults/{vault_id}/credentials/{credential_id}"
payload := strings.NewReader("{}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Api-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"type": "vault_credential",
"id": "vcrd_011CZkZEMt8gZan2iYOQfSkw",
"vault_id": "vlt_011CZkZDLs7fYzm1hXNPeRjv",
"display_name": "示例凭证",
"metadata": {
"environment": "production"
},
"created_at": "2026-03-15T10:00:00Z",
"updated_at": "2026-03-15T10:00:00Z",
"archived_at": null,
"auth": {
"type": "static_bearer",
"mcp_server_url": "https://example-server.modelcontextprotocol.io/sse"
}
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}{
"error": {
"message": "Invalid request",
"type": "invalid_request_error"
},
"request_id": "<string>",
"type": "error"
}