使用 Spree 获取订单的产品 API
Get products of an order with Spree API
我只是想获取我的Spree电子商务系统的所有订单,包括用户在一个订单中购买的所有产品。我看到我可以抓取所有订单、所有发货,但没有关于包含用户购买的产品的 "complete" 查询的信息。
有办法吗?
GET /api/v1/orders 是一个分页查询,其响应应如下所示:
{
"orders": [
{
"id": 1,
"number": "R335381310",
"item_total": "100.0",
"display_item_total": "0.00",
"total": "100.0",
"display_total": "0.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,这是您正在寻找的产品。
我只是想获取我的Spree电子商务系统的所有订单,包括用户在一个订单中购买的所有产品。我看到我可以抓取所有订单、所有发货,但没有关于包含用户购买的产品的 "complete" 查询的信息。
有办法吗?
GET /api/v1/orders 是一个分页查询,其响应应如下所示:
{
"orders": [
{
"id": 1,
"number": "R335381310",
"item_total": "100.0",
"display_item_total": "0.00",
"total": "100.0",
"display_total": "0.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,这是您正在寻找的产品。