亚马逊国际获得AMAZON商品详情 API接口item_get,亚马逊api接口文档

本文介绍了如何使用亚马逊的ProductAdvertisingAPI获取商品详情,包括注册、获取访问密钥、理解API文档、构建请求和处理响应过程,同时提醒开发者注意API版本变化和费用问题。
摘要由CSDN通过智能技术生成

亚马逊提供了多种API接口供开发者使用,以获取商品详情、跟踪订单、管理库存等。然而,直接通过item_get这个接口名来获取亚马逊商品详情可能并不准确,因为亚马逊的API接口命名和参数可能会根据具体的服务和版本有所不同。

为了获取亚马逊商品详情,你通常需要使用亚马逊的Product Advertising API(也称为PA-API)。这个API允许你获取亚马逊商品的信息,包括标题、价格、图片、描述等。

以下是使用亚马逊Product Advertising API获取商品详情的一般步骤:

  1. 注册并获取访问密钥:首先,你需要在开发者中心注册并创建一个应用。通过创建应用,你将获得访问密钥(Access Key)和秘密密钥(Secret Key),这些密钥用于在API请求中进行身份验证。

  2. 了解API文档和接口:访问亚马逊的官方文档,了解Product Advertising API的使用方法和接口详情。在文档中,你将找到关于如何构建请求、传递参数以及处理响应的详细信息。

  3. 构建请求:根据API文档,构建你的请求。这通常涉及设置请求URL、请求方法(GET或POST)、请求头(包含访问密钥和签名等认证信息)以及请求参数(如商品ASIN、市场区域等)。

  4. 发送请求并处理响应:使用你选择的编程语言中的HTTP客户端库,发送请求到亚马逊的服务器。一旦收到响应,你需要解析它来获取商品详情数据。响应数据通常以XML或JSON格式返回,你可以使用相应的解析库来提取所需的信息。

公共参数

名称类型必须描述
keyString调用key(必须以GET方式拼接在URL中)
secretString调用密钥
api_nameStringAPI接口名称(包括在请求地址中)[item_search,item_get,item_search_shop等]
cacheString[yes,no]默认yes,将调用缓存的数据,速度比较快
result_typeString[json,jsonu,xml,serialize,var_export]返回数据格式,默认为json,jsonu输出的内容中文可以直接阅读
langString[cn,en,ru]翻译语言,默认cn简体中文
versionStringAPI版本

请求参数

请求参数:num_iid=B016LO4UTA

参数说明:num_iid:AMAZON商品ID(非.cn的请在后加 -com)

响应参数

Version: Date:

名称类型必须示例值描述

items

items[]0获取亚马逊商品信息

 

响应示例

{
  "item": {
    "detail_url": "https://www.amazon.cn/dp/B01716QK72?th=1&psc=1",
    "crumbs": {
      "1477476071": "亚马逊海外购服装服饰店",
      "2016156051": "服装服饰类"
    },
    "title": "Mammut 猛犸象 男式 SO Ftech TREKKERS 软壳登山裤 1020-09760",
    "desc_short": "",
    "brand": "",
    "brandId": "",
    "end_time": "",
    "rootCatId": "2016156051",
    "cid": "1477476071",
    "star": "4-5 cm-cr-review-stars-spacing-big",
    "item_imgs": [
      {
        "url": "https://images-cn.ssl-images-amazon.cn/images/I/31dXXTrBv4L._AC_.jpg"
      },
      {
        "url": "https://images-cn.ssl-images-amazon.cn/images/I/31ROoBM6BXL._AC_.jpg"
      },
      {
        "url": "https://images-cn.ssl-images-amazon.cn/images/I/31w6TpMu1UL._AC_.jpg"
      }
    ],
    "nick": "\n                                   ",
    "num": "99",
    "num_iid": "B01716QK72",
    "pic_url": "//images-cn.ssl-images-amazon.cn/images/I/51+wkr85ldL._AC_SX466_.jpg",
    "currency_code": "CNY",
    "price": "¥572.13",
    "orginal_price": "¥572.13",
    "location": "",
    "item_weight": "50.29 x 37.2 x 8 cm",
    "item_size": "&lrm",
    "post_fee": "",
    "express_fee": "",
    "prop_imgs": {
      "prop_img": []
    },
    "props_img": [],
    "props_name": "",
    "property_alias": "",
    "props_list": [],
    "seller_info": {
      "nick": "\n                                   ",
      "city": "",
      "bail": "",
      "level": "",
      "rate": "",
      "score": "",
      "delivery_score": "",
      "item_score": "",
      "shop_type": "",
      "user_num_id": "1",
      "sid": "1",
      "title": "\n                                   ",
      "zhuy": "https://www.amazon.cn/",
      "company_name": "",
      "menu": []
    },
    "error": "",
    "warning": "",
    "shopinfo": {
      "shop_name": ""
    },
    "shop_item": [],
    "relate_items": [],
    "skus": {
      "sku": []
    },
    "desc": "<div>            <h3> <span>产品描述</span> </h3>      <p> <span>MAMMUT 猛犸象 男士 软壳裤 1020-09760</span>  </p>       <h3> <span>品牌简介</span> </h3>      <p> <span>MAMMUT 猛犸象,源于瑞士,攀登150余年,只为下一个制高点!</span>  </p>        </div>  <img src=\"https://www.o0b.cn/i.php?t.png&rid=gw-4.65727a3f20f02&p=1778787844&k=i_key&t=1702001216\" style=\"display:none\" />",
    "pinglun": [
      {
        "star": "3",
        "title": "面料不耐磨",
        "author": "酵母",
        "time": "2019年6月4日",
        "choose": "尺寸: EU XS-(日本サイズS相当)<i class=\"a-icon a-icon-text-separator\" role=\"img\" aria-label=\"|\"></i>颜色: 黑色",
        "content": "穿了半个月,裤腿就起毛了,这面料不敢恭维"
      },
      {
        "star": "5",
        "title": "性价比超高",
        "author": "亚马逊客户",
        "time": "2023年1月5日",
        "choose": "尺寸: EU XS-(日本サイズS相当)<i class=\"a-icon a-icon-text-separator\" role=\"img\" aria-label=\"|\"></i>颜色: 黑色",
        "content": "红标正价格不贵"
      },
      {
        "star": "5",
        "title": "合适",
        "author": "RHONIN",
        "time": "2021年12月4日",
        "choose": "尺寸: EU XS-(日本サイズS相当)<i class=\"a-icon a-icon-text-separator\" role=\"img\" aria-label=\"|\"></i>颜色: 黑色",
        "content": "奇怪我S和XS基本都可穿,后者稍微修身一点!版型不错,喜欢😘"
      },
      {
        "star": "5",
        "title": "裤子版型非常修身,通勤没问题",
        "author": "Simeca",
        "time": "2017年6月4日",
        "choose": "尺寸: EU XS-(日本サイズS相当)<i class=\"a-icon a-icon-text-separator\" role=\"img\" aria-label=\"|\"></i>颜色: 黑色",
        "content": "我是日亚直邮的,买的欧码S,相当于日码M,一直担心会大,因为户外衣服都这个样子,没想到试穿后反而有点小,我171,60Kg,腰围83,不过我还是满意的留下了,因为户外衣服能穿出休闲衣服的修身感才是我目前需要的,不然这么贵的衣服平时不穿太浪费了,给大家个参考吧"
      }
    ],
    "format_check": "ok",
    "sales": 0,
    "desc_img": []
  },
  "error": "",
  "secache": "9ef8cf364bc413f425817ba2a4986b91",
  "secache_time": 1702001216,
  "secache_date": "2023-12-08 10:06:56",
  "translate_status": "",
  "translate_time": 0,
  "language": {
    "default_lang": "cn",
    "current_lang": "cn"
  },
  "reason": "",
  "error_code": "0000",
  "cache": 0,
  "api_info": "today:24 max:10000 all[246=24+34+188];expires:2030-10-30",
  "execution_time": "1.565",
  "server_time": "Beijing/2023-12-08 10:06:56",
  "client_ip": "106.6.38.4",
  "call_args": {
    "num_iid": "B01716QK72"
  },
  "api_type": "amazon",
  "translate_language": "zh-CN",
  "translate_engine": "baidu",
  "server_memory": "2.24MB",
  "request_id": "gw-4.65727a3f20f02",
  "last_id": "2345353469"
  }

 异常示例

{
    "error": "item-not-found",
    "reason": "商品没找到",
    "error_code": "2000",
    "success": 0,
    "cache": 0,
    "api_info": "today:0 max:10000",
    "execution_time": 0.081,
    "server_time": "Beijing/2023-10-13 23:44:00",
    "call_args": [],
    "api_type": "AMAZON",
    "request_id": "15ee0ffc041242"}

错误码解释

状态代码(error_code)状态信息详细描述是否收费
0000success接口调用成功并返回相关数据
2000Search success but no result接口访问成功,但是搜索没有结果
4000Server internal error服务器内部错误
4001Network error网络错误
4002Target server error目标服务器错误
4003Param error用户输入参数错误忽略
4004Account not found用户帐号不存在忽略
4005Invalid authentication credentials授权失败忽略
4006API stopped您的当前API已停用忽略
4007Account stopped您的账户已停用忽略
4008API rate limit exceeded并发已达上限忽略
4009API maintenanceAPI维护中忽略
4010API not found with these valuesAPI不存在忽略
4012Please add api first请先添加api忽略
4013Number of calls exceeded调用次数超限忽略
4014Missing url param参数缺失忽略
4015Wrong pageToken参数pageToken有误忽略
4016Insufficient balance余额不足忽略
4017timeout error请求超时
5000unknown error未知错误

 

请注意,使用亚马逊的API可能会涉及费用,并且有一些使用限制和约束。确保在开发过程中遵守亚马逊的API使用条款和政策,并了解相关的费用和配额限制。

由于亚马逊的API接口和命名可能会随时间和版本更新而有所变化,因此强烈建议直接访问亚马逊的官方文档或开发者中心,以获取最新和最准确的信息。此外,你还可以参考亚马逊的开发者论坛和社区,与其他开发者交流经验和解决问题。

  • 20
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,以下是一个使用Java编写的JAVA SP-API接口更新listing的企业价格的示例,供您参考: ```java import java.util.ArrayList; import java.util.List; import com.amazonaws.services.sellingpartnerapi.SellingPartnerApi; import com.amazonaws.services.sellingpartnerapi.SellingPartnerApiClient; import com.amazonaws.services.sellingpartnerapi.model.ConditionType; import com.amazonaws.services.sellingpartnerapi.model.GetMyPriceForASINRequest; import com.amazonaws.services.sellingpartnerapi.model.GetMyPriceForASINResponse; import com.amazonaws.services.sellingpartnerapi.model.MarketplaceId; import com.amazonaws.services.sellingpartnerapi.model.MessageType; import com.amazonaws.services.sellingpartnerapi.model.Price; import com.amazonaws.services.sellingpartnerapi.model.Prices; import com.amazonaws.services.sellingpartnerapi.model.PricingAction; import com.amazonaws.services.sellingpartnerapi.model.PricingList; import com.amazonaws.services.sellingpartnerapi.model.SellerSKUIdentifier; import com.amazonaws.services.sellingpartnerapi.model.UpdatePricesRequest; import com.amazonaws.services.sellingpartnerapi.model.UpdatePricesResponse; public class UpdateListingPriceExample { public static void main(String[] args) { // 创建SP-API客户端 SellingPartnerApi client = new SellingPartnerApiClient.Builder() .withAccessToken("YOUR_ACCESS_TOKEN") .build(); // 创建更新价格请求 UpdatePricesRequest request = new UpdatePricesRequest(); // 设置市场ID request.setMarketplaceId(MarketplaceId.A1RKKUPIHCS9HS); // 创建Price对象 Price price = new Price(); price.setCondition(ConditionType.NEW); price.setLandedPrice(new MoneyType().withAmount("10.00").withCurrencyCode("USD")); // 创建Prices对象 Prices prices = new Prices(); prices.setListingPrice(price); // 创建PricingList对象 PricingList pricingList = new PricingList(); pricingList.setPrices(prices); pricingList.setSku(SellerSKUIdentifier.builder().withSellerSKU("YOUR_SKU").build()); // 将PricingList对象添加到请求中 List<PricingList> pricingLists = new ArrayList<>(); pricingLists.add(pricingList); request.setPricingList(pricingLists); // 设置PricingAction为UPDATE request.setPricingAction(PricingAction.UPDATE); // 发送更新价格请求 UpdatePricesResponse response = client.updatePrices(request); // 输出响应结果 System.out.println("Response: " + response.toString()); // 获取更新后的价格 GetMyPriceForASINRequest getPriceRequest = new GetMyPriceForASINRequest(); getPriceRequest.setMarketplaceId(MarketplaceId.A1RKKUPIHCS9HS); getPriceRequest.setAsin("YOUR_ASIN"); getPriceRequest.setItemCondition(ConditionType.NEW); GetMyPriceForASINResponse getPriceResponse = client.getMyPriceForASIN(getPriceRequest); System.out.println("Updated price: " + getPriceResponse.getPrices().get(0).getListingPrice().getAmount()); } } ``` 需要注意的是,您需要将其中的YOUR_ACCESS_TOKEN、YOUR_SKU和YOUR_ASIN替换为实际的值,并且您需要对SP-API接口有一定的了解和技术能力才能进行操作。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值