Skip to content

Storage

Authentication

参考接入 BytePower

Upload File

接口功能: 上传文件



Method & Path

  • POST {domain}/bp/ai/v2/storage
  • POST {domain}/bp/server/user/{user_id}/ai/v2/storage

Request

  • content-type: "multipart/form-data"
ParametersTypeRequiredDesc
namestringtrue文件名
datafiletrue文件
full_urlbooleanfalse是否返回全路径,默认 false

Response

  • HTTP 状态码:200
json
{
  "storage": {
    "storage_id": "AISD7J7ZDUHRGVDO",
    "path": "ai/storage/rabbit.png",
    "created_time": "2023-11-10T12:22:10.311993+08:00",
    "updated_time": "2023-11-10T12:22:10.311993+08:00"
  }
}
  • HTTP 状态码:4xx
json
{
  "error": {
    "error_type": "invalid_parameter",
    "message": "xxxxx"
  }
}

error_type:

  • item_not_found(找不到条目)
  • config_invalid (console 配置问题)

Delete File

接口功能: 删除文件

Method & Path

  • DELETE {domain}/bp/ai/v2/storage/{storage_id}
  • DELETE {domain}/bp/server/user/{user_id}/ai/v2/storage/{storage_id}

Get File

接口功能: 获取文件

Method & Path

  • GET {domain}/bp/ai/v2/storage/{storage_id}
  • GET {domain}/bp/server/user/{user_id}/ai/v2/storage/{storage_id}

Response

  • HTTP 状态码:200
json
{
  "storage": [
    {
      "storage_id": "AISD7J7ZDUHRGVDO",
      "path": "ai/storage/rabbit.png",
      "created_time": "2023-11-10T04:22:10.311993Z",
      "updated_time": "2023-11-10T04:22:10.311993Z"
    }
  ]
}
  • HTTP 状态码:4xx
json
{
  "error": {
    "error_type": "invalid_parameter",
    "message": "xxxxx"
  }
}

error_type:

  • item_not_found(找不到条目)
  • config_invalid (console 配置问题)

京ICP备19011570号-2