BigCommerce更清晰的回应

时间:2013-07-26 16:16:55

标签: api httpresponse api-design bigcommerce

当程序试图发布已存在的货件时,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>

我同意这是一个错误的请求,但它与项目的数量无关。我们可以为messageinvalid_reason执行以下操作吗?

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

这将使更多可用的API。

1 个答案:

答案 0 :(得分:2)

在查询订单产品资源时,可以提供可用数量,当您创建货件时,可用数量将减少为0.

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