从更清晰的Bigcommerce响应 [英] Clearer response from BigCommerce

查看:210
本文介绍了从更清晰的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>

我同意这是一个错误的请求,但它无关的项目的数量。我们可以做类似的消息,以下 INVALID_REASON 呢?

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

这将使一个更有用的API。

This would make for a much more usable API.

推荐答案

在查询订购产品的资源有出货的可用数量,并为您创建一个货件(S)的可用数量减少到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天全站免登陆