注意:以下文档只适用于TOP接口,请谨慎使用!

文档中心 > API类目 > 采购宝API

taobao.pc.item.quantity.query (查询商品库存信息)

查询商品库存信息

公共参数

请求参数

名称 类型 是否必须 示例值 更多限制 描述
param BatchQuantityParam 可选 商品库存查询参数
  • item_list
  • QuantityParam []
  • 必须
  • 商品信息
  • └ quantity
  • Number
  • 可选
  • 20
  • 库存数量
  • └ ego_item_id
  • Number
  • 必须
  • 800000000001
  • 企业购商品ID
  • └ ego_sku_id
  • Number
  • 可选
  • 4000000000008
  • 企业购商品SKUID
  • └ client_id
  • String
  • 必须
  • 10000001
  • 客户ID
  • └ service_id
  • Number
  • 可选
  • 20000001
  • 服务商ID
  • └ service_nick
  • String
  • 可选
  • 测试服务商1
  • 服务商名称

响应参数

名称 类型 示例值 描述
result Result result
  • └ success
  • Boolean
  • true
  • 操作是否成功
  • └ error_code
  • String
  • 200
  • 结果码
  • └ error_msg
  • String
  • 参数错误
  • 结果描述
  • ego_item_quantity_d_t_o_list
  • EgoItemQuantityDto []
  • 结果
  • └ ego_item_id
  • Number
  • 800000000001
  • 企业购商品ID
  • skus
  • EgoSkuQuantityDto []
  • sku列表
  • └ ego_sku_id
  • Number
  • 5000000000001
  • skuId
  • └ fuzzy_quantity
  • String
  • IN_STOCK
  • 模糊化库存,有货:IN_STOCK,库存紧张:LOW_STOCK,无货:OUT_OF_STOCK;入参指定库存数量时,实际库存数量小于传入库存数量则为OUT_OF_STOCK,否则为IN_STOCK;入参不指定库存数量时,实际库存数量小于等于0则为OUT_OF_STOCK,实际库存数量小于等于某一个特定值时则为LOW_STOCK,否则为IN_STOCK
  • └ quantity
  • Number
  • 200
  • 库存数量,实际库存数量小于等于某一个特定值时返回实际库存,否则返回特定值(并非实际库存)
  • └ fuzzy_quantity
  • String
  • IN_STOCK
  • 模糊化库存,有货:IN_STOCK,库存紧张:LOW_STOCK,无货:OUT_OF_STOCK;入参指定库存数量时,实际库存数量小于传入库存数量则为OUT_OF_STOCK,否则为IN_STOCK;入参不指定库存数量时,实际库存数量小于等于0则为OUT_OF_STOCK,实际库存数量小于等于某一个特定值时则为LOW_STOCK,否则为IN_STOCK
  • └ quantity
  • Number
  • 200
  • 库存数量,实际库存数量小于等于某一个特定值时返回实际库存,否则返回特定值(并非实际库存)

请求示例

  • JAVA
  • .NET
  • PHP
  • CURL
  • Python
  • C/C++
  • NodeJS
TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
PcItemQuantityQueryRequest req = new PcItemQuantityQueryRequest();
PcItemQuantityQueryRequest.BatchQuantityParam obj1 = new PcItemQuantityQueryRequest.BatchQuantityParam();
List<PcItemQuantityQueryRequest.QuantityParam> list3 = new ArrayList<PcItemQuantityQueryRequest.QuantityParam>();
PcItemQuantityQueryRequest.QuantityParam obj4 = new PcItemQuantityQueryRequest.QuantityParam();
list3.add(obj4);
obj4.setQuantity(20L);
obj4.setEgoItemId(800000000001L);
obj4.setEgoSkuId(4000000000008L);
obj1.setItemList(list3);
obj1.setClientId("10000001");
obj1.setServiceId(20000001L);
obj1.setServiceNick("测试服务商1");
req.setParam(obj1);
PcItemQuantityQueryResponse rsp = client.execute(req);
System.out.println(rsp.getBody());

响应示例

  • XML示例
  • JSON示例
<pc_item_quantity_query_response>
    <result>
        <success>true</success>
        <error_code>200</error_code>
        <error_msg>参数错误</error_msg>
        <ego_item_quantity_d_t_o_list>
            <ego_item_quantity_dto>
                <ego_item_id>800000000001</ego_item_id>
                <skus>
                    <ego_sku_quantity_dto>
                        <ego_sku_id>5000000000001</ego_sku_id>
                        <fuzzy_quantity>IN_STOCK</fuzzy_quantity>
                        <quantity>200</quantity>
                    </ego_sku_quantity_dto>
                </skus>
                <fuzzy_quantity>IN_STOCK</fuzzy_quantity>
                <quantity>200</quantity>
            </ego_item_quantity_dto>
        </ego_item_quantity_d_t_o_list>
    </result>
</pc_item_quantity_query_response>

异常示例

  • XML示例
  • JSON示例
<error_response>
    <code>50</code>
    <msg>Remote service error</msg>
    <sub_code>isv.invalid-parameter</sub_code>
    <sub_msg>非法参数</sub_msg>
</error_response>

错误码解释

错误码 错误描述 解决方案

API工具

如何获得此API

FAQ

返回
顶部