linkfox-amazon-store-uploads

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Amazon 店铺 Uploads(文件上传)

Amazon 店铺 Uploads(文件上传)

本 skill 专用于 向 Amazon 申请上传目的地并上传文件,与
linkfox-amazon-store-auth
同系列:先
storeTokens
,再
developerProxy
调用 createUploadDestinationForResource,最后用
upload_to_destination.py
对返回的 URL 执行 PUT(不经网关)。
这是 Uploads API,不是 Orders 订单接口。订单见
linkfox-amazon-store-orders
;批量 Feed 文件见
linkfox-amazon-store-feeds
本 skill 专用于 向 Amazon 申请上传目的地并上传文件,与
linkfox-amazon-store-auth
同系列:先
storeTokens
,再
developerProxy
调用 createUploadDestinationForResource,最后用
upload_to_destination.py
对返回的 URL 执行 PUT(不经网关)。
这是 Uploads API,不是 Orders 订单接口。订单相关请见
linkfox-amazon-store-orders
;批量 Feed 文件请见
linkfox-amazon-store-feeds

官方参考

官方参考

Prerequisites

前置条件

  1. 依赖
    linkfox-amazon-store-auth
  2. resource
    须与下游 API 文档一致(例如 A+:
    aplus/2020-11-01/contentDocuments
    ;Messaging 为对应 messages 资源路径)。
  3. contentMD5
    为待上传文件内容的 Base64 MD5 摘要;传
    filePath
    /
    content
    时脚本可自动计算。

  1. 依赖
    linkfox-amazon-store-auth
  2. resource
    必须与下游 API 文档一致(例如 A+:
    aplus/2020-11-01/contentDocuments
    ;Messaging 为对应 messages 资源路径)。
  3. contentMD5
    为待上传文件内容的 Base64 MD5 摘要;传入
    filePath
    /
    content
    时脚本可自动计算。

工作流

工作流

text
create_upload_destination_for_resource  →  uploadDestination { uploadDestinationId, url, headers }
upload_to_destination (PUT url + headers)  →  在 A+/Messaging 等 API 中引用 uploadDestinationId

text
create_upload_destination_for_resource  →  uploadDestination { uploadDestinationId, url, headers }
upload_to_destination (PUT url + headers)  →  在 A+/Messaging 等 API 中引用 uploadDestinationId

Scripts

脚本

脚本说明
create_upload_destination_for_resource.py
POST
uploads/2020-11-01/uploadDestinations/{resource}
upload_to_destination.py
PUT 到返回的
url
(带
headers
_spapi_uploads_common.py
内部公共模块

脚本说明
create_upload_destination_for_resource.py
POST
uploads/2020-11-01/uploadDestinations/{resource}
upload_to_destination.py
PUT 到返回的
url
(携带
headers
_spapi_uploads_common.py
内部公共模块

示例

示例

bash
export LINKFOXAGENT_API_KEY="<your-key>"
bash
export LINKFOXAGENT_API_KEY="<your-key>"

1) 创建上传目的地(自动根据 filePath 计算 contentMD5)

1) 创建上传目的地(自动根据 filePath 计算 contentMD5)

python scripts/create_upload_destination_for_resource.py '{ "sellerId":"A1...", "region":"NA", "resource":"aplus/2020-11-01/contentDocuments", "marketplaceId":"ATVPDKIKX0DER", "filePath":"/path/to/banner.jpg", "contentType":"image/jpeg" }'
python scripts/create_upload_destination_for_resource.py '{ "sellerId":"A1...", "region":"NA", "resource":"aplus/2020-11-01/contentDocuments", "marketplaceId":"ATVPDKIKX0DER", "filePath":"/path/to/banner.jpg", "contentType":"image/jpeg" }'

2) 上传文件(将上一步 stdout 中的 uploadDestination 传入)

2) 上传文件(将上一步 stdout 中的 uploadDestination 传入)

python scripts/upload_to_destination.py '{ "uploadDestination": { "url": "...", "headers": { } }, "filePath": "/path/to/banner.jpg" }'

---
python scripts/upload_to_destination.py '{ "uploadDestination": { "url": "...", "headers": { } }, "filePath": "/path/to/banner.jpg" }'

---

Display Rules

显示规则

  1. 成功创建目的地常为 HTTP 201;先看
    developerProxy
    ,再看
    uploadDestination
  2. resource
    不要带前导
    /
    ;path 中会对
    /
    做编码。
  3. 网关需放行
    uploads/2020-11-01/
    前缀。
Feedback:
skillName
linkfox-amazon-store-uploads

更多跨境 skill:LinkFox Skills
<!-- LF_LARGE_RESPONSE_BLOCK -->
  1. 成功创建目的地通常返回 HTTP 201;优先查看
    developerProxy
    ,再查看
    uploadDestination
  2. resource
    不要带前导
    /
    ;路径中会对
    /
    进行编码。
  3. 网关需放行
    uploads/2020-11-01/
    前缀。
反馈:
skillName
linkfox-amazon-store-uploads

更多跨境 skill:LinkFox Skills
<!-- LF_LARGE_RESPONSE_BLOCK -->

Handling Large Responses

处理大响应

To avoid overflowing the agent context, persist the response to disk and extract only the fields you need:
python scripts/response_io.py run --script scripts/check_auth_dependency.py --out-dir <DIR> '<params>'
python scripts/response_io.py read <file> --fields "<paths>"   # or --path "<JMESPath>"
Pick
--out-dir
outside any git working tree (e.g.
/tmp/...
on Unix,
%TEMP%/...
on Windows). Persisted responses may contain PII, pricing, or auth-sensitive data — do not commit them. Files are not auto-deleted; clean up when the task is done.
This skill exposes multiple entry scripts:
check_auth_dependency.py
,
create_upload_destination_for_resource.py
,
upload_to_destination.py
. Pass
--script scripts/<name>.py
to choose the one you need.
run
writes the full response to a file and emits only a schema preview + file path.
read
projects specific fields, with
--limit/--offset
for slicing and
--format json|jsonl|csv|table
for output.
When to prefer this pattern — apply your judgment based on the response characteristics, e.g.:
  • High field count per record, or fields you don't need
  • Batch/paginated results (multiple items per call)
  • Long-text fields (descriptions, reviews, HTML, time series)
  • Output reused across later steps rather than consumed immediately
For small, single-use responses, calling the main script directly is fine.
⚠️ The preview is a truncated schema + sample, not the full data. Any field-level decision must read from the persisted file via
read
.
<!-- /LF_LARGE_RESPONSE_BLOCK -->
为避免超出 Agent 上下文限制,可将响应持久化到磁盘并仅提取所需字段:
python scripts/response_io.py run --script scripts/check_auth_dependency.py --out-dir <DIR> '<params>'
python scripts/response_io.py read <file> --fields "<paths>"   # 或 --path "<JMESPath>"
请将
--out-dir
选择在 git 工作区之外(例如 Unix 系统的
/tmp/...
,Windows 系统的
%TEMP%/...
)。持久化的响应可能包含个人身份信息(PII)、定价或敏感认证数据——请勿提交这些文件。文件不会自动删除;任务完成后请自行清理。
本 skill 提供多个入口脚本:
check_auth_dependency.py
create_upload_destination_for_resource.py
upload_to_destination.py
。通过传递
--script scripts/<name>.py
选择所需脚本。
run
会将完整响应写入文件,并仅输出 schema 预览 + 文件路径。
read
会提取指定字段,支持通过
--limit/--offset
进行切片,以及通过
--format json|jsonl|csv|table
指定输出格式。
何时优先使用此模式——根据响应特性自行判断,例如:
  • 每条记录字段数量多,或包含不需要的字段
  • 批量/分页结果(单次调用返回多条数据)
  • 长文本字段(描述、评论、HTML、时间序列)
  • 输出需在后续步骤中复用,而非立即使用
对于小型、单次使用的响应,直接调用主脚本即可。
⚠️ 预览内容是截断的 schema + 示例,并非完整数据。任何基于字段的决策都必须通过
read
从持久化文件中读取。
<!-- /LF_LARGE_RESPONSE_BLOCK -->