编程

亚马逊-店铺上传

试用

亚马逊店铺文件上传(与 linkfox-amazon-store-auth 等同系列),经 /spApi/developerProxy 调用 Uploads API v2020-11-01 的 createUploadDestinationForResource,再向返回 URL 上传文件,供 A+ Content、Messaging 等 API 使用。当用户提到上传文件、createUploadDestinationForResource、upload destination、contentMD5、预签名上传、SP-API 上传、A+ 图片上传、Messaging 附件上传 时触发。

它能做什么

亚马逊店铺文件上传(与 linkfox-amazon-store-auth 等同系列),经 /spApi/developerProxy 调用 Uploads API v2020-11-01 的 createUploadDestinationForResource,再向返回 URL 上传文件,供 A+ Content、Messaging 等 API 使用。当用户提到上传文件、createUploadDestinationForResource、upload destination、contentMD5、预签名上传、SP-API 上传、A+ 图片上传、Messaging 附件上传 时触发。

技能文档

Amazon 店铺 Uploads(文件上传)

本 skill 专用于 向 Amazon 申请上传目的地并上传文件,与 linkfox-amazon-store-auth 同系列:依赖 linkfox-amazon-store-auth 选店(sellerId+region);直接 POST /spApi/developerProxy 传入 sellerId+region 调用 createUploadDestinationForResource,最后用 upload_to_destination.py 对返回的 URL 执行 PUT(不经网关)。

这是 Uploads API,不是 Orders 订单接口。订单见 linkfox-amazon-store-orders;批量 Feed 文件见 linkfox-amazon-store-feeds

调用方式

  • API 端点POST /spApi/developerProxy(不同操作通过请求体区分;完整参数/响应/错误码见 references/api.md
  • Python 脚本python scripts/<脚本名>.py '' [--inline](可用脚本见上文脚本一览)
  • 成本约束:本工具会消耗积分;失败/空结果不得自动换关键词、翻页或连续试探;需要继续检索时先向用户说明会产生额外消耗。

输出策略(脚本默认行为)

  • 始终将完整响应写入 /linkfox///data/linkfox-amazon-store-uploads-.json 为脚本执行时的工作目录,在 Claude Code 里即当前项目目录; 取自环境变量 SESSION_ID,按用户任务自动聚合;禁止写入 /tmp,当前目录不可写则报错)
  • 响应体 ≤ 8 KB:落盘后把完整 JSON 打印到 stdout
  • 响应体 > 8 KB:落盘后 stdout 只输出摘要(顶层字段、常见计数如 total/costToken、最大列表字段的长度 + 前 3 条样本)
  • --inline 强制全量打印到 stdout(同样落盘)

读数据建议:先看摘要判断是否足够;需要具体字段时优先用 jqConvertFrom-Json 从保存的 json 文件按需抽取,避免整份 JSON 进入上下文。

解决认证和积分问题

发生以下异常情况时,采用 references/onboarding.md 引导解决问题:

异常情况

  • 未配置API Key:环境变量未配置 LINKFOX_AGENT_API_KEY,也未配置 LINKFOXAGENT_API_KEY
  • 响应401或402状态码
  • 响应提示积分或余额不足:消息含"积分余额不足/计费不足/余额不足/quota exceeded/insufficient balance/套餐到期/需充值/请充值",或类似含义的内容。

官方参考

createUploadDestinationForResource · Create an upload destination


Prerequisites

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

工作流

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.pyPOST uploads/2020-11-01/uploadDestinations/{resource}
upload_to_destination.pyPUT 到返回的 url(带 headers
_spapi_uploads_common.py内部公共模块

示例

export LINKFOXAGENT_API_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"
}'

Display Rules

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

积分消耗规则

不消耗积分。

Feedback: skillNamelinkfox-amazon-store-uploads


更多跨境 skill:LinkFox Skills

相关技能

亚马逊店铺 Feeds(与 linkfox-amazon-store-auth / report / listings / pricing / orders 同系列),经 /spApi/developerProxy 调用 SP-API Feeds v2021-06-30:createFeedDocument、getFeedDocument、createFeed、getFeed、getFeeds、cancelFeed;另含 upload_feed_document 向预签名 URL 上传内容。当用户提到亚马逊 Feed、提交库存/Listing Feed、POST_FLAT_FILE、feedType、feedDocumentId、feedId、取消 Feed、查询 Feed 处理状态、Feeds API、SP-API 上传文件 时触发。

14 次安装

经 SP-API A+ Content Management v2020-11-01 管理亚马逊 A+ 页面文档的检索、创建、更新、关联、审核与暂停。

14 次安装

通过 /spApi/developerProxy 调用 SP-API Orders,覆盖 v2026-01-01 与 v0 的查询、发货与管制订单接口。

14 次安装

亚马逊店铺 Fulfillment by Amazon(FBA)系列(与 linkfox-amazon-store-auth 同系列),经 /spApi/developerProxy 调用 SP-API:FBA Inbound Eligibility(getItemEligibilityPreview)、FBA Inventory(getInventorySummaries/createInventoryItem/deleteInventoryItem/addInventory)、Fulfillment Inbound v2024-03-20(InboundPlan/装箱/放置/运输/货件等)与 v0(prepInstructions/labels/BOL/shipments)、Fulfillment Outbound 2020-07-01(MCF 履约单/预览/退货/tracking/features)。当用户提到 FBA、入仓资格、Inbound Eligibility、FBA 库存摘要、Send to Amazon、Inbound Plan、FBA 货件、MCF、多渠道履约、getItemEligibilityPreview、getInventorySummaries、createInboundPlan、createFulfillmentOrder 时触发。与 External Fulfillment / 普通 Orders 不同。

1 次安装

亚马逊店铺商品目录 Catalog(与 linkfox-amazon-store-auth / report / listings / pricing / orders / feeds 同系列),经 /spApi/developerProxy 调用 SP-API Catalog Items:v0 listCatalogCategories;v2022-04-01(默认)或 v2020-12-01 的 searchCatalogItems、getCatalogItem。当用户提到亚马逊目录、Catalog Items、listCatalogCategories、searchCatalogItems、getCatalogItem、按 ASIN 查目录、关键词搜商品目录、类目节点、includedData、summaries/images 时触发。

14 次安装

通过统一代理端点调用亚马逊 SP-API 的 Listings、Restrictions 与 Product Type Definitions。

14 次安装