taobao.inventory.query (查询商品库存信息)

建议使用新接口:tmall.inventory.query.forstore ,新ISV不推荐使用。 商家查询商品总体库存信息

公共参数

请求参数

名称 类型 是否必须 示例值 更多限制 描述
sc_item_ids String 必须 1234^2456 后端商品ID 列表,控制到50个
sc_item_codes String 可选 GLY201210120001^GLY23214141 后端商品的商家编码列表,控制到50个
seller_nick String 可选 Nike 卖家昵称
store_codes String 可选 GLY001^GLY002 仓库列表:GLY001^GLY002

响应参数

名称 类型 示例值 描述
item_inventorys InventorySum [] 商品总体库存信息
  • └ reserve_quantity
  • Number
  • 40
  • 总预扣数量
  • └ inventory_type
  • Number
  • 1
  • 库存类型: 1:正常 2:损坏 3:冻结 10:质押 11-20:商家自定义
  • └ store_code
  • String
  • ABC0001
  • 商家仓库编码
  • └ inventory_type_name
  • String
  • 正常
  • 库存类型名称
  • └ sc_item_id
  • Number
  • 0
  • 商品后端ID,如果有传sc_item_code,参数可以为0
  • └ sc_item_code
  • String
  • 1234
  • 商品商家编码
  • └ quantity
  • Number
  • 100
  • 总物理库存数量
  • └ occupy_quantity
  • Number
  • 60
  • 总占用数量
tip_infos TipInfo [] 提示信息,提示不存在的后端商品
  • └ sc_item_id
  • String
  • demo
  • 商品id
  • └ info
  • String
  • demo
  • 返回信息

请求示例

  • JAVA
  • .NET
  • PHP
  • CURL
  • Python
  • C/C++
  • NodeJS
TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
InventoryQueryRequest req = new InventoryQueryRequest();
req.setScItemIds("1234^2456");
req.setScItemCodes("GLY201210120001^GLY23214141");
req.setSellerNick("Nike");
req.setStoreCodes("GLY001^GLY002");
InventoryQueryResponse rsp = client.execute(req, sessionKey);
System.out.println(rsp.getBody());

响应示例

  • XML示例
  • JSON示例
<inventory_query_response>
    <item_inventorys>
        <inventory_sum>
            <reserve_quantity>40</reserve_quantity>
            <inventory_type>1</inventory_type>
            <store_code>ABC0001</store_code>
            <inventory_type_name>正常</inventory_type_name>
            <sc_item_id>0</sc_item_id>
            <sc_item_code>1234</sc_item_code>
            <quantity>100</quantity>
            <occupy_quantity>60</occupy_quantity>
        </inventory_sum>
    </item_inventorys>
    <tip_infos>
        <tip_info>
            <sc_item_id>demo</sc_item_id>
            <info>demo</info>
        </tip_info>
    </tip_infos>
</inventory_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>

错误码解释

错误码 错误描述 解决方案
isv.inventory-error:00005 必填参数为空 请传入有效参数。
isv.inventory-error:20002 后端商品不存在 请传入有效后端商品。
isv.inventory-error:00006 数据库访问错误 请稍候再试。
isv.inventory-error:20006 商品ID非数字错误 检查商品ID
isv.inventory-error:20005 库存查询商品数量过多 减少查询商品数量

API工具

如何获得此API

FAQ

返回
顶部