api-config.json 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. {
  2. "name": "product-detail-query",
  3. "displayName": "Amazon 产品详情查询",
  4. "description": "根据 ASIN 获取 Amazon 产品详情,包括标题、价格、评分、销量、BSR、品牌、类目、变体、趋势等完整信息。用于竞品分析、市场全景、定价策略。",
  5. "category": "voc",
  6. "version": "1.3.0",
  7. "endpoint": {
  8. "method": "POST",
  9. "url": "https://server.fmode.cn/api/voc-ecom/forward",
  10. "headers": {
  11. "Content-Type": "application/json",
  12. "Authorization": "Bearer {{vocToken}}"
  13. }
  14. },
  15. "parameters": {
  16. "type": "object",
  17. "required": [
  18. "ASIN"
  19. ],
  20. "properties": {
  21. "ASIN": {
  22. "type": "string",
  23. "description": "Amazon 产品唯一标识符(10位字母数字),必须大写。例:B0CSVRWJ1H",
  24. "pattern": "^[A-Z0-9]{10}$"
  25. },
  26. "domain": {
  27. "type": "integer",
  28. "description": "Amazon 站点 ID: 1=amazon.com, 2=amazon.co.uk, 3=amazon.de, 4=amazon.co.jp, 5=amazon.fr, 6=amazon.it, 7=amazon.es, 8=amazon.ca",
  29. "default": 1,
  30. "enum": [
  31. 1,
  32. 2,
  33. 3,
  34. 4,
  35. 5,
  36. 6,
  37. 7,
  38. 8
  39. ]
  40. },
  41. "Trend": {
  42. "type": "integer",
  43. "description": "是否返回趋势数据: 1=是, 0=否",
  44. "default": 1,
  45. "enum": [
  46. 0,
  47. 1
  48. ]
  49. },
  50. "QueryTrendStartDt": {
  51. "type": "string",
  52. "description": "趋势数据起始日期,格式 YYYYMMDD,留空则使用默认范围",
  53. "default": ""
  54. },
  55. "QueryTrendEndDt": {
  56. "type": "string",
  57. "description": "趋势数据结束日期,格式 YYYYMMDD,留空则使用默认范围",
  58. "default": ""
  59. }
  60. }
  61. },
  62. "requestTransform": {
  63. "description": "将参数转换为 Sorftime forward 格式",
  64. "template": {
  65. "path": "/api/ProductRequest",
  66. "method": "POST",
  67. "query": {
  68. "domain": "{{domain}}"
  69. },
  70. "body": {
  71. "ASIN": "{{ASIN}}",
  72. "Trend": "{{Trend}}",
  73. "QueryTrendStartDt": "{{QueryTrendStartDt}}",
  74. "QueryTrendEndDt": "{{QueryTrendEndDt}}"
  75. }
  76. }
  77. },
  78. "response": {
  79. "type": "object",
  80. "description": "产品详情对象",
  81. "properties": {
  82. "Title": {
  83. "type": "string",
  84. "description": "产品标题"
  85. },
  86. "Price": {
  87. "type": "number",
  88. "description": "当前售价(美元)"
  89. },
  90. "SalesPrice": {
  91. "type": "number",
  92. "description": "促销价(美元)"
  93. },
  94. "Brand": {
  95. "type": "string",
  96. "description": "品牌名称"
  97. },
  98. "StoreName": {
  99. "type": "string",
  100. "description": "店铺名称"
  101. },
  102. "Rating": {
  103. "type": "number",
  104. "description": "平均评分 (0-5)"
  105. },
  106. "RatingsCount": {
  107. "type": "integer",
  108. "description": "评论总数"
  109. },
  110. "fiveStartRatings": {
  111. "type": "number",
  112. "description": "5星评分百分比"
  113. },
  114. "fourStartRatings": {
  115. "type": "number",
  116. "description": "4星评分百分比"
  117. },
  118. "threeStartRatings": {
  119. "type": "number",
  120. "description": "3星评分百分比"
  121. },
  122. "twoStartRatings": {
  123. "type": "number",
  124. "description": "2星评分百分比"
  125. },
  126. "oneStartRatings": {
  127. "type": "number",
  128. "description": "1星评分百分比"
  129. },
  130. "MonthlySales": {
  131. "type": "integer",
  132. "description": "月销量估算"
  133. },
  134. "BSR": {
  135. "type": "integer",
  136. "description": "Best Sellers Rank 大类排名"
  137. },
  138. "Category": {
  139. "type": "array",
  140. "description": "类目层级"
  141. },
  142. "BsrCategory": {
  143. "type": "array",
  144. "description": "BSR 类目层级"
  145. },
  146. "Photo": {
  147. "type": "array",
  148. "description": "产品图片 URL 列表"
  149. },
  150. "Feature": {
  151. "type": "object",
  152. "description": "产品 Bullet Points 卖点"
  153. },
  154. "Description": {
  155. "type": "string",
  156. "description": "产品描述"
  157. },
  158. "Property": {
  159. "type": "string",
  160. "description": "产品属性(JSON 字符串)"
  161. },
  162. "VariationASIN": {
  163. "type": "array",
  164. "description": "变体 ASIN 列表"
  165. },
  166. "Size": {
  167. "type": "array",
  168. "description": "尺寸选项"
  169. },
  170. "ShipsFrom": {
  171. "type": "string",
  172. "description": "发货地"
  173. },
  174. "ProductType": {
  175. "type": "string",
  176. "description": "配送类型 (FBA/FBM)"
  177. },
  178. "DealType": {
  179. "type": "string",
  180. "description": "促销类型"
  181. },
  182. "UpdateDate": {
  183. "type": "string",
  184. "description": "数据更新日期"
  185. }
  186. }
  187. },
  188. "usageExamples": [
  189. {
  190. "name": "查询单个产品详情",
  191. "input": {
  192. "ASIN": "B0CSVRWJ1H",
  193. "domain": 1,
  194. "Trend": 1
  195. },
  196. "description": "获取美国站产品 B0CSVRWJ1H 的完整信息和趋势数据"
  197. }
  198. ],
  199. "reportMapping": {
  200. "slides": [
  201. "市场全景(Slide3)",
  202. "竞品对标(Slide4)",
  203. "品类矩阵(Slide6)"
  204. ],
  205. "dataPoints": [
  206. "价格",
  207. "评分",
  208. "月销量",
  209. "BSR",
  210. "品牌",
  211. "类目"
  212. ]
  213. },
  214. "timeout": 60000,
  215. "retry": {
  216. "maxAttempts": 3,
  217. "delay": 1000,
  218. "backoffMultiplier": 2
  219. },
  220. "tokenConfig": {
  221. "type": "bearer",
  222. "configFile": "~/.openclaw/voc-credentials.json",
  223. "tokenField": "vocToken",
  224. "resolutionOrder": [
  225. "configFile"
  226. ],
  227. "apigId": "7HwdQZk55B",
  228. "paymentUrlResolution": {
  229. "description": "动态构建充值URL:在已存在 session token 时查出用户 objectId,拼接到专属充值页面",
  230. "steps": [
  231. "1. 从 voc-credentials.json 获取当前 session token",
  232. "2. 调用 GET https://server.fmode.cn/parse/users/me (Header: X-Parse-Application-Id: ncloudmaster, X-Parse-Session-Token: {token})获取用户 objectId",
  233. "3. 拼接充值URL: https://app.fmode.cn/dev/apig-pay/?user={objectId}&apigid=7HwdQZk55B&fun_id=HOkkX72PMF",
  234. "4. 将该URL展示给用户,引导扫码支付"
  235. ],
  236. "userResolveEndpoint": "https://server.fmode.cn/parse/users/me",
  237. "userResolveHeaders": {
  238. "X-Parse-Application-Id": "ncloudmaster",
  239. "X-Parse-Session-Token": "{vocToken}"
  240. },
  241. "paymentBaseUrl": "https://app.fmode.cn/dev/apig-pay/",
  242. "paymentParams": {
  243. "user": "{resolvedUserId}",
  244. "apigid": "7HwdQZk55B",
  245. "fun_id": "HOkkX72PMF"
  246. },
  247. "balanceCheckEndpoint": "https://server.fmode.cn/api/apig/getApig"
  248. },
  249. "onMissing": {
  250. "action": "showPaymentQR",
  251. "qrCodeUrl": "https://app.fmode.cn/dev/apig-pay/?apigid=7HwdQZk55B&fun_id=HOkkX72PMF",
  252. "title": "扫码开通 VOC-AI 数据服务",
  253. "message": "此 Skill 需要有效的 API Token。请先打开充值页面完成登录和充值;当用户提供 session token 后,请由 OpenClaw 运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json 的 vocToken 字段,再重试当前 Skill。",
  254. "tokenSetupCommandTemplate": "node scripts/tools/set-voc-token.js {sessionToken}",
  255. "tokenSetupInstructions": "当用户完成登录和充值后,如果用户把 session token 发给你,请直接运行 node scripts/tools/set-voc-token.js <session-token> 写入 ~/.openclaw/voc-credentials.json,然后重试当前 Skill。"
  256. },
  257. "onBalanceInsufficient": {
  258. "action": "resolveUserThenShowPayment",
  259. "title": "VOC-AI Token 余额不足,请扫码充值",
  260. "message": "当前 Token 余额不足,我将为你生成专属充值链接,扫码支付后即可继续使用。"
  261. }
  262. },
  263. "errorHandling": {
  264. "balanceInsufficient": {
  265. "conditions": [
  266. {
  267. "responseField": "code",
  268. "operator": "in",
  269. "value": [
  270. -2,
  271. -3,
  272. -10,
  273. 402,
  274. 429
  275. ]
  276. },
  277. {
  278. "responseField": "msg",
  279. "operator": "contains",
  280. "value": [
  281. "余额不足",
  282. "insufficient",
  283. "balance",
  284. "quota",
  285. "没有开通",
  286. "权限或余额"
  287. ]
  288. },
  289. {
  290. "responseField": "mess",
  291. "operator": "contains",
  292. "value": [
  293. "余额不足",
  294. "insufficient",
  295. "balance",
  296. "quota",
  297. "没有开通",
  298. "权限或余额"
  299. ]
  300. },
  301. {
  302. "responseField": "message",
  303. "operator": "contains",
  304. "value": [
  305. "余额不足",
  306. "insufficient",
  307. "balance",
  308. "没有开通",
  309. "权限或余额"
  310. ]
  311. }
  312. ],
  313. "matchMode": "any",
  314. "trigger": "tokenConfig.onBalanceInsufficient"
  315. },
  316. "unauthorized": {
  317. "conditions": [
  318. {
  319. "responseField": "code",
  320. "operator": "in",
  321. "value": [
  322. 401,
  323. 403
  324. ]
  325. },
  326. {
  327. "responseField": "msg",
  328. "operator": "contains",
  329. "value": [
  330. "unauthorized",
  331. "token",
  332. "invalid",
  333. "auth"
  334. ]
  335. }
  336. ],
  337. "matchMode": "any",
  338. "trigger": "tokenConfig.onMissing"
  339. }
  340. }
  341. }