我需要你的帮助,我尝试了所有提到的建议(https://github.com/amzn/selling-partner-api-docs/issues/2167),但仍然无法用Amazon更新库存数量。
我正在尝试更新没有提要的数量库存。
下面的正文,我是发送更新数量和投入的要求。
我使用的包是:https://github.com/jlevers/selling-partner-api
SellingPartnerApi\Model\ListingsV20210801\ListingsItemPutRequest Object
(
[container:protected] => Array
(
[product_type] => FALSE_EYELASH
[requirements] =>
[attributes] => Array
(
[fulfillment_availability] => Array
(
[fulfillment_channel_code] => AMAZON_JP
[quantity] => 5
)
)
)
)
当我使用沙箱时,得到一个响应,接受了,但是没有错误。
........
[sku] => 2629-48KGT-2347 // TEST
[status] => INVALID
[submission_id] => 602b84b73b964e24b174a80d3a7870a3
[issues] => Array
(
[0] => SellingPartnerApi\Model\ListingsV20210801\Issue Object
(
[container:protected] => Array
(
[code] => 4000003
[message] => ������������Amazon������������������������������������������������������������������������������
[severity] => ERROR
[attribute_names] =>
)
)
)
........
=======================
为了修补请求,我正在尝试下面的身体。
SellingPartnerApi\Model\ListingsV20210801\ListingsItemPatchRequest Object
(
[container:protected] => Array
(
[product_type] => FALSE_EYELASH
[patches] => Array
(
[op] => replace
[operation_type] => UPDATE // Already try with or without this parameter
[path] => /attributes/fulfillment_availability
[value] => Array
(
[fulfillment_channel_code] => AMAZON_JP
[quantity] => 5
)
)
)
)
得到下面的回应。
Exception when calling: [400] {
"errors": [
{
"code": "InvalidInput",
"message": "Request has missing or invalid parameters and cannot be parsed.",
"details": ""
}
]
}
是否有任何方法来更新订单状态,使之在没有提要API的情况下交付?
到目前为止,我尝试的代码如下。
$patchBody = [
'product_type' => 'BEAUTY',
'marketplaceIds' => ['A1VC38T7YXB528'], // Already try with or without
'patches' => [
[
"op" => "replace",
"operation_type" => "PARTIAL_UPDATE",
"path" => "/attributes/fulfillment_availability",
"value" => [
[
"fulfillment_channel_code" => 'DEFAULT',
"quantity" => 2
]
]
]
]
];
$putBody = [
'product_type' => 'BEAUTY',
'attributes' => [
"fulfillment_availability" => [
"fulfillment_channel_code" => "DEFAULT",
"quantity" => 2
]
]
];
$seller_id = 'MY-SELLER-ID';
$sku = '8001025974';
$marketplace_ids = array('A1VC38T7YXB528');
// Update inventory
$apiInstance = new SellingPartnerApi\Api\ListingsV20210801Api($config);
$body = new \SellingPartnerApi\Model\ListingsV20210801\ListingsItemPatchRequest($patchBody);
// $issue_locale = 'en_US';
try {
$result = $apiInstance->patchListingsItem($seller_id, $sku, $marketplace_ids, $body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling: ', $e->getMessage(), PHP_EOL;
}
发布于 2022-08-03 06:01:35
我找到了解决方案,主要问题是在body中,有许多不同的方法是由amazon基础或列表put/修补程序库提供的。
在我的问题中,我使用的是基于列表的方法。
端点URL在下面。
{{fe_url}}/listings/2021-08-01/items/{{seller_id}}/8001025974?marketplaceIds={{jp_market_id}}
身体应该像下面这样。如果产品类型有错误,即使您传递当前的产品类型,只需使用" product "。
注释:,但是如果您使用提要文档,那么它可能会被更改为请看这里
我从下面的身体中获得了成功。
{
"productType": "PRODUCT",
"patches": [
{
"op": "replace",
"operation_type": "PARTIAL_UPDATE",
"path": "/attributes/fulfillment_availability",
"value": [
{
"fulfillment_channel_code": "DEFAULT",
"quantity": 0
}
]
}
]
}
https://stackoverflow.com/questions/73147023
复制相似问题