AssetService.UploadAsset
上传资产
直接上传小文件(建议 < 4MB),文件数据通过 gRPC 消息体传输。大文件请使用预签名上传流程。
Authentication
| 支持组合 | OAuth 2.0 | API Key |
|---|---|---|
| No identity | ||
| User identity | ||
| Org identity |
所需 scopes:creative:write
Request body · UploadAssetRequest
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
project_id | string | — | 所属项目 ID。 |
filename | string | — | 原始文件名。 |
content_type | string | — | MIME 类型,例如 "image/png"、"video/mp4"。 |
data | string (byte) | — | 文件二进制数据。 |
metadata | object | — | 扩展元数据。 |
wechat_mp_credentials | WechatMpCredentials | — | 微信公众号 API 调用凭证。 当 server 需要把素材上传到微信公众号素材库时必填(图片 / 视频 / 缩略图)。 详见 WechatMpCredentials 设计说明(types.proto)。 |
Response
200 OK · UploadAssetResponse
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
asset | Asset | — | 上传成功后返回的素材信息(含 asset_id 和 url)。 |
错误响应 · google.rpc.Status
非 2xx 响应均按 AIP-193 规范包装为google.rpc.Status,含 code /message /details 三段。details[].reason 是机器可读的具体错误原因码,可用于客户端分支处理。
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
code | integer (int32) | — | The status code, which should be an enum value of google.rpc.Code. |
message | string | — | A developer-facing error message. |
details | array<Any> | — | A list of messages that carry the error details. |
Examples
curl -X POST \
'https://api.appforges.com/v1/creative/assets' \
-H 'Authorization: Bearer $ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"project_id": "string",
"filename": "string",
"content_type": "string",
"data": "<base64>",
"metadata": {},
"wechat_mp_credentials": {
"app_id": "string",
"app_secret": "string"
}
}'OpenAPI spec v0.59.4 · synced 10/11/2026, 11:27:14 PM