本 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。
createUploadDestinationForResource · Create an upload destination
linkfox-amazon-store-auth。resource 须与下游 API 文档一致(例如 A+:aplus/2020-11-01/contentDocuments;Messaging 为对应 messages 资源路径)。contentMD5 为待上传文件内容的 Base64 MD5 摘要;传 filePath / content 时脚本可自动计算。create_upload_destination_for_resource → uploadDestination { uploadDestinationId, url, headers }
upload_to_destination (PUT url + headers) → 在 A+/Messaging 等 API 中引用 uploadDestinationId
| 脚本 | 说明 |
|---|---|
| ------ | ------ |
create_upload_destination_for_resource.py | POST uploads/2020-11-01/uploadDestinations/{resource} |
upload_to_destination.py | PUT 到返回的 url(带 headers) |
_spapi_uploads_common.py | 内部公共模块 |
export LINKFOXAGENT_API_KEY="<your-key>"
# 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"
}'
# 2) 上传文件(将上一步 stdout 中的 uploadDestination 传入)
python scripts/upload_to_destination.py '{
"uploadDestination": { "url": "...", "headers": { } },
"filePath": "/path/to/banner.jpg"
}'
developerProxy,再看 uploadDestination。resource 不要带前导 /;path 中会对 / 做编码。uploads/2020-11-01/ 前缀。Feedback: skillName:linkfox-amazon-store-uploads。
更多跨境 skill:LinkFox Skills
共 1 个版本