跳转到主要内容
POST /api/v1/forward/resources/registry 按资源 ID 注册已有资源。接口为 upsert 语义:首次注册返回 201 Created,后续注册更新返回 200 OK

请求头

Header是否必填说明
AuthorizationBearer <PAT>
Content-Typeapplication/json
Idempotency-Key有副作用请求可选的幂等键。

请求体参数

参数类型是否必填说明
typestring资源类型,支持 skillfilevaultenvironment
resourceobject资源对象,仅使用 resource.id
resource.idstring资源 ID,例如 skill_...file_...

示例请求

curl -s -X POST 'https://api.qoder.com/api/v1/forward/resources/registry' \
  -H "Authorization: Bearer $QODER_PAT" \
  -H "Content-Type: application/json" \
  -d '{
  "type": "skill",
  "resource": {
    "id": "skill_xxx"
  }
}'

示例响应

HTTP 200 OK
{
  "id": "skill_xxx",
  "type": "skill"
}

响应字段

字段类型说明
idstringForward Resource ID,直接等于资源 ID。
typestring资源类型。

错误

HTTPTypeCode触发条件
400invalid_request_error-缺少或不支持 type、缺少 resource.id,或请求体格式非法。
403permission_error-当前调用方无权访问该资源。
404not_found_error-资源不存在,或声明的 type 与实际类型不匹配。
401authentication_errorauthentication_requiredPAT 无效或已过期。

注意事项

  • 请先通过资源 API 创建或更新资源,再注册到 Forward。

相关

列出 Resources

创建 Template