跳至内容
ShopentlyLearn

产品 · 添加文件 · upload_id

创建 upload_id 后,以 multipart/form-data 上传文件,再关联到商品。下载需要 Bearer 令牌及 category 对应权限;响应直接包含文件字节,不使用公开地址或密码。 共享销售文件的明确访问规则。 new_purchases / recent_and_new / selected / all_purchasers.

POST/api/v1/product-file-uploads

cURL 请求

curl --disable --globoff --fail-with-body --silent --show-error \
  --proto '=https' --connect-timeout 5 --max-time 30 \
  --request POST \
  --url 'https://shop.onshopently.com/api/v1/product-file-uploads?category=digital' \
  --header 'Authorization: Bearer EXAMPLE_ACCESS_TOKEN' \
  --header 'Idempotency-Key: files-example-create_upload_api_v1_product_file_uploads_post' \
  --header 'Content-Type: application/json' \
  --data-raw '{"filename":"manual.pdf","product_id":"example","sha256":"5cd2f1cb0e5532b397e7ab1887baf6000c49450fd80ae279eb047c06e4545ecd","size_bytes":46}'

响应

{
  "data": {
    "deleted": false,
    "id": "00000000-0000-4000-8000-000000000001",
    "version": null
  },
  "meta": {
    "request_id": "example"
  }
}

所需权限

身份验证
访问令牌
最低套餐
STANDARD
所需权限
特定字段所需的附加权限
  • category=internal: 管理商品文件 · 内部文件catalog.product_file:write_internal
  • category=customer_document: 管理商品文件 · 客户文档catalog.product_file:write_customer_document
  • category=digital: 管理商品文件 · 数字商品catalog.product_file:write_digital