我使用的是亚马逊-sp-api (亚马逊销售合作伙伴API的JavaScript客户端),但这并不限于此客户端。我想做的就是使用Amazon列表API的putListingsItem调用来更新我列出的商品的价格和数量。
productType
根据ListingsItemPutRequest文档,这个调用需要productType
和attributes
。
首先,要获得正确的productType
值,需要使用产品类型定义API搜索产品定义类型。因此,我这样做,并调用searchDefinitionsProductTypes,只是为了发现我的产品没有匹配的产品类型。
最后,我给出了PRODUCT
字段的productType
值。使用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_price
和fulfillment_availability
必须是价格和quantity,然后在下面的代码中尝试使用这些价格。
属性
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或数量,以使此调用成功?
只需尝试更新一个项目的价格和数量。
发布于 2022-06-27 13:41:26
这方面的文档很糟糕。不过,我已经设法通过了一些尝试和错误。
可以用这个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"
}]
希望这能帮你:)
https://stackoverflow.com/questions/71711129
复制相似问题