开发者文档

获取文件上传签名

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

权限与前置条件

工作区所有者或管理员;受责任交接规则约束。

支持账号中心 API Key:Authorization: Bearer <ltak_…>。中心每次实时校验,仍执行当前用户的工作区角色和业务权限。Cookie 写入仍需允许来源的 Origin 和 X-Requested-With: suren360。不能同时携带 Cookie 与 API Key。所有路径参数须使用真实 ID。

上传分三步:申请签名 → 按 uploadUrl 和 fields 直传对象存储 → 调用 complete 核验。签名和下载地址短时有效,请勿写入公开日志。发布计划不会代发到社交平台。

请求参数

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,并授权素人种草 360 应用,将密钥安全设置为 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
}
查看错误码与重试规则