开发者文档

获取素材上传签名

POST/api/orgs/:orgId/publishing-groups/:id/uploads

权限与前置条件

工作区所有者、管理员或计划创建人可上传草稿素材。取得 uploadUrl 和 fields 后,以表单直传文件,再调用确认素材上传。

支持账号中心 API Key 和网页登录会话。 查看鉴权要求

请求参数

orgId · 路径参数 · 必填字符串

id · 路径参数 · 必填字符串

JSON 请求体

字段类型必填约束
namestring是{"minLength":1,"maxLength":255}
mimestring是{"maxLength":100}
sizeinteger是{"exclusiveMinimum":0,"maximum":524288000}
requestIdstring是{"minLength":1,"maxLength":64}
查看完整请求 JSON Schema
JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255
    },
    "mime": {
      "type": "string",
      "maxLength": 100
    },
    "size": {
      "type": "integer",
      "exclusiveMinimum": 0,
      "maximum": 524288000
    },
    "requestId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64
    }
  },
  "required": [
    "name",
    "mime",
    "size",
    "requestId"
  ],
  "additionalProperties": false
}

调用示例

先在统一账号中心创建 Key,并授权本应用,将密钥安全设置为 LINGTU_API_KEY 环境变量。 请替换部署地址与示例字段,不要将凭证粘贴到聊天或日志中。

cURL · 示例占位值需替换
curl --request POST \
  'https://YOUR_DEPLOYMENT_HOST/api/orgs/YOUR_orgId/publishing-groups/YOUR_id/uploads' \
  --header "Authorization: Bearer $LINGTU_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "替换为实际值",
  "mime": "替换为实际值",
  "size": 1,
  "requestId": "替换为实际值"
}'

响应结构

成功返回 HTTP 200 的 JSON 对象。下方为响应结构定义,不是虚构的业务数据。

字段类型必填约束
fileobject是{"required":["id","name","mime","size","kind","status"],"additionalProperties":false}
uploadUrlstring是{}
fieldsobject是{"propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}}
查看完整响应 JSON Schema
JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "file": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "mime": {
          "type": "string"
        },
        "size": {
          "type": "number"
        },
        "kind": {
          "type": "string",
          "enum": [
            "video",
            "image",
            "document"
          ]
        },
        "status": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "name",
        "mime",
        "size",
        "kind",
        "status"
      ],
      "additionalProperties": false
    },
    "uploadUrl": {
      "type": "string"
    },
    "fields": {
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {
        "type": "string"
      }
    }
  },
  "required": [
    "file",
    "uploadUrl",
    "fields"
  ],
  "additionalProperties": false
}
查看错误码与重试规则