【问题标题】:Amazon SP-API Listings API putListingsItem How To Update price and quantity? Node.jsAmazon SP-API Listings API putListingsItem 如何更新价格和数量?节点.js
【发布时间】:2022-06-27 21:41:26
【问题描述】:

我正在使用amazon-sp-api(亚马逊销售合作伙伴 API 的 JavaScript 客户端),但这不限于此客户端。我要做的就是使用 Amazon SP-API Listings API 的putListingsItem call 来更新我列出的商品的价格和数量。

产品类型

根据ListingsItemPutRequest 文档,此调用需要productTypeattributes

首先,要获得正确的productType 值,您应该使用Product Type Definitions API 搜索产品定义类型。所以,我这样做了,并打电话给searchDefinitionsProductTypes,只是为了发现我的产品没有匹配的产品类型。

最终,我为productType 字段提供了值PRODUCT。使用PRODUCT,我调用了getDefinitionsProductType,得到了一个包含propertyNames数组的对象,如下所示:


            "propertyNames": [
                "skip_offer",
                "fulfillment_availability",
                "map_policy",
                "purchasable_offer",
                "condition_type",
                "condition_note",
                "list_price",
                "product_tax_code",
                "merchant_release_date",
                "merchant_shipping_group",
                "max_order_quantity",
                "gift_options",
                "main_offer_image_locator",
                "other_offer_image_locator_1",
                "other_offer_image_locator_2",
                "other_offer_image_locator_3",
                "other_offer_image_locator_4",
                "other_offer_image_locator_5"
            ]
        },

看到这一点,我决定 list_pricefulfillment_availability 必须是 pricequantity,然后尝试在下面的代码中使用它们。

属性

attributes 值也是必需的。但是,他们当前的文档没有显示为这些值添加什么的明确示例,这是我必须将价格和数量放在某处的地方。

我找到了这个关于patchListingsItem 的链接,并尝试在下面实现它,但出错了。

代码:

// trying to update quantity... failed.

        a.response =  await a.sellingPartner.callAPI({
            operation:'putListingsItem',
            path:{
              sellerId: process.env.SELLER_ID,
              sku: `XXXXXXXXXXXX`
            },
            query: {
              marketplaceIds: [ `ATVPDKIKX0DER` ]
            },
            body: {
              "productType": `PRODUCT`
              "requirements": "LISTING_OFFER_ONLY",
              "attributes": {
                    "fulfillment_availability": {
                        "fulfillment_channel_code": "AMAZON_NA",
                                "quantity": 4,
                                "marketplace_id": "ATVPDKIKX0DER"
                            }
                        }
          });

        console.log( `a.response: `, a.response )

错误:

{
    "sku": "XXXXXXXXXXXX",
    "status": "INVALID",
    "submissionId": "34e1XXXXXXXXXXXXXXXXXXXX",
    "issues": [
        {
            "code": "4000001",
            "message": "The provided value for 'fulfillment_availability' is invalid.",
            "severity": "ERROR",
            "attributeName": "fulfillment_availability"
        }
    ]
}

我也尝试过使用 list_price :

// list_price attempt... failed.


        a.response =  await a.sellingPartner.callAPI({
            operation:'putListingsItem',
            path:{
              sellerId: process.env.SELLER_ID,
              sku: `XXXXXXXXXXXX`
            },
            query: {
              marketplaceIds: [ `ATVPDKIKX0DER` ]
            },
            body: {
              "productType": `PRODUCT`
              "requirements": "LISTING_OFFER_ONLY",
              "attributes": {
                    "list_price": {
                        "Amount": 90,
                        "CurrencyCode": "USD"
                    }
          });

        console.log( `a.response: `, a.response )

错误(这次我好像变热了……也许吧?):

{
    "sku": "XXXXXXXXXXXX",
    "status": "INVALID",
    "submissionId": "34e1XXXXXXXXXXXXXXXXXXXX",
    "issues": [
        {
            "code": "4000001",
            "message": "The provided value for 'list_price' is invalid.",
            "severity": "ERROR",
            "attributeName": "list_price"
        }
    ]
}

您如何正确指定 list_price 或数量以使此调用成功?

只是尝试更新单个商品的价格和数量。

【问题讨论】:

    标签: amazon-web-services aws-sdk amazon-mws amazonsellercentral amz-sp-api


    【解决方案1】:

    这方面的文档很糟糕。不过,我已经通过相当多的试验和错误设法获得了一些。

    可以使用此 JSON 块设置履行和可用性

    "fulfillment_availability": [{
    "fulfillment_channel_code": "DEFAULT", 
    "quantity": "9999", 
    "lead_time_to_ship_max_days": "5"
    }]
    

    并且奇怪的是,使用此块设置了标价。不过,我仍在尝试找出如何设置含税的标价。

    "purchasable_offer": [{
    "currency": "GBP",
    "our_price": [{"schedule": [{"value_with_tax": 285.93}]}],
    "marketplace_id": "A1F83G8C2ARO7P"
    }]
    

    希望对你有所帮助:)

    【讨论】:

      猜你喜欢
      • 2022-06-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-24
      • 1970-01-01
      • 2021-02-27
      相关资源
      最近更新 更多