Spree API - 使用初始库存数量创建产品变体

Spree API - Create Product Variant with Initial stock quantity

我正在尝试通过应用程序中的 API 创建具有初始库存量的变体。

示例URL:

--post http://localhost:3000/api/products/apache-baseball-Jersey/variants/

我找不到办法做到这一点。我试图传递参数: 变量 [数量]、stock_item [count_on_hand] 等

在 Spree 文档中,要创建 "stock_item,",您需要在 /api/stock_locations /1/stock_items 上执行新请求.但我只想提出一个要求。

有可能吗?

我们无法发送 count_on_hand 和一个 api 请求,因为我们可以在多个位置管理我们的产品库存,因此我们需要通过每个库存位置一个请求来管理它,这就是为什么需要它发送 count_on_hand 和另一个 api 请求。