BigCommerce 更明确的回应 [英] Clearer response from BigCommerce

查看:16
本文介绍了BigCommerce 更明确的回应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当程序尝试发布已存在的货件时,BigCommerce 能否更改其 API 响应以使其更加清晰?

Can BigCommerce change their API response to be more clear when a program tries to post a shipment that already exists?

向 BigCommerce 发布货件时,如果货件已存在,您会收到以下错误消息.

When posting shipments to BigCommerce, if the shipment already exists, then you receive the following error message.

<?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 执行以下操作吗?

I agree that it is a bad request, but it has nothing to do with the quantity of the item. Can we do something like the following for the message or invalid_reason instead?

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

这将使 API 更加有用.

This would make for a much more usable API.

推荐答案

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

When querying the order products resource there is an available quantity to ship, and as you create a shipment(s) the available quantity is reduced to 0.

>

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

Initially a shipment POST is successful as the quantity specified in the payload matches that of the order. If you were to POST a shipment to an order that has already been shipped then the available quantity is actually 0, and when you specify a positive integer for quantity in the payload it is invalid and greater than the available quantity, so the error is accurate.

这篇关于BigCommerce 更明确的回应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆