使用Spree API获取订单产品

时间:2017-01-09 09:31:30

标签: api spree product

我只想获得我的Spree电子商务系统的所有订单,以及用户在订单中购买的所有产品。我看到我可以获取所有订单,所有货件,但没有关于包含用户购买的产品的“完整”查询的信息。

有办法做到这一点吗?

1 个答案:

答案 0 :(得分:1)

GET / api / v1 / orders是一个分页查询,其响应应该类似于:

{
"orders": [
  {
    "id": 1,
    "number": "R335381310",
    "item_total": "100.0",
    "display_item_total": "$100.00",
    "total": "100.0",
    "display_total": "$100.00",
    "state": "cart",
    "adjustment_total": "-12.0",
    "user_id": null,
    "created_at": "2012-10-24T01:02:25Z",
    "updated_at": "2012-10-24T01:02:25Z",
    "completed_at": null,
    "payment_total": "0.0",
    "shipment_state": null,
    "payment_state": null,
    "email": null,
    "special_instructions": null,
    "total_quantity": 1,
    "token": "abcdef123456",
    "line_items": [
    ],
    "adjustments": [
    ],
    "payments": [
    ],
    "shipments": [
    ]
  }
],
"count": 25,
"pages": 5,
"current_page": 1
}

每个订单都包含line_items,这是您正在寻找的产品。

来源:http://guides.spreecommerce.org/api/orders.html