2

当程序尝试发布已经存在的货件时,BigCommerce 是否可以将其 API 响应更改为更清晰?

将货件过帐到 BigCommerce 时,如果货件已经存在,那么您会收到以下错误消息。

<?xml version="1.0"?>
<errors>
    <error>
        <status>400</status>
        <message>The field 'quantity' is invalid.</message>
        <details>
            <invalid_reason>The quantity specified is greater than the quantity of the product that is available to ship.</invalid_reason>
            <available_quantity>0</available_quantity>
            <order_product_id>628</order_product_id>
        </details>
    </error>
</errors>

我同意这是一个糟糕的要求,但这与物品的数量无关。message我们可以为or做类似以下的事情invalid_reason吗?

The shipment [insert ID here] already exists and cannot be added.

这将使 API 更加可用。

4

1 回答 1

2

查询订单产品资源时,有一个可用的发货数量,当您创建一个货件时,可用数量减少到 0。

最初装运 POST 是成功的,因为有效负载中指定的数量与订单的数量相匹配。如果您要向已经发货的订单发送发货,则可用数量实际上为 0,当您在有效负载中为数量指定正整数时,它是无效的并且大于可用数量,因此错误是准确的.

于 2014-03-27T17:12:05.460 回答