Application

创建授权

创建授权

POST /application/v1/workers/{worker_id}/grants

Let this Worker's platform token access one of your databases, folders or knowledge bases.

支持状态: supported

参数

名称位置类型必填说明
worker_idpathstringtrueWorker ID (wkr_…).

请求体 (application/json)

必填: true

名称类型说明
resourceobjectResource to grant.
resource.typestringResource type.
resource.idstringResource ID in your account.
accessstringAccess level.
{
  "type": "object",
  "required": [
    "resource",
    "access"
  ],
  "properties": {
    "resource": {
      "type": "object",
      "description": "Resource to grant.",
      "required": [
        "type",
        "id"
      ],
      "properties": {
        "type": {
          "type": "string",
          "description": "Resource type.",
          "enum": [
            "database",
            "folder",
            "knowledge"
          ],
          "x-enum-descriptions": {
            "database": "A database.",
            "folder": "A file folder.",
            "knowledge": "A knowledge base."
          },
          "example": "database"
        },
        "id": {
          "type": "string",
          "description": "Resource ID in your account.",
          "example": "db_01example"
        }
      }
    },
    "access": {
      "type": "string",
      "description": "Access level.",
      "enum": [
        "read",
        "read_write"
      ],
      "x-enum-descriptions": {
        "read": "Read only.",
        "read_write": "Read and write."
      },
      "example": "read"
    }
  }
}

响应

HTTP 200

Success

application/json

名称类型说明
idstringGrant ID, prefixed grt_.
worker_idstringOwning Worker.
resourceobjectGranted resource.
resource.typestringResource type.
resource.idstringResource ID.
accessstringAccess level.
created_onstringWhen the grant was created.
导出

本页内容