📦訂單品項

此 API 為 2024-10-04 後版本 v.2.62.11 開放。

最佳實踐

在整合過程中,訂單品項(contact-order-item)需指定產品(Product)及其所屬訂單(order)。整合步驟如下:

  1. 根據訂單編號(order_number)找到對應的訂單ID(contact_order_id)。

  2. 根據產品編號(sku)或其他資訊取得產品ID(product_id)。

  3. 使用訂單編號(order_number)和產品ID(product_id)來建立或更新訂單品項。

這些步驟確保每個訂單品項正確關聯到相應的產品和訂單,提升資料整合的準確性與效率。

搜尋

GET https://{API_DOMAIN}/api/v1/contact-order/{contact_order}/contact-order-item
curl -X GET
    -H "Content-Type: application/json"
    '{"name": "vip"}'
    https://{API_HOST}/api/v1/{contact_order}/contact-order-item

URL Parameters

Response

{
    "data": [
        {
            "id": 2,
            "quantity": 1,
            "total_price_before_discounts": "3100.00",
            "total_discount": "0.00",
            "total_price_after_discounts": "3100.00",
            "product_id": 3,
            "contact_order_id": 1,
            "product":
            {
                "id": 3,
                "name": "女款 Dunk 低筒鞋 Medium Olive",
                "sku": "DD1503-120",
                "price": 3100,
            },
            "created_at": "2024-09-27 15:44:03",
            "updated_at": "2024-09-27 15:44:03"
        }
    ],
    "links": { ... },
    "meta": { ... }
}

取得單筆資料

GET https://{API_DOMAIN}/api/v1/contact-order/{contact_order}/contact-order-item/{contact_order_item}
curl -X GET
    -H "Content-Type: application/json"
    https://{API_HOST}/api/v1/contact-order/1/contact-order-item/36

URL Parameters

Response

{
    "data": {
        "id": 2,
        "quantity": 1,
        "total_price_before_discounts": "3100.00",
        "total_discount": "0.00",
        "total_price_after_discounts": "3100.00",
        "product_id": 3,
        "contact_order_id": 1,
        "product":
        {
            "id": 3,
            "name": "女款 Dunk 低筒鞋 Medium Olive",
            "sku": "DD1503-120",
            "price": 3100,
        },
        "created_at": "2024-09-27 15:44:03",
        "updated_at": "2024-09-27 15:44:03"
    }
}

新增

POST https://{API_DOMAIN}/api/v1/contact-order/{contact_order}/contact-order-item
curl -X POST
    -H "Content-Type: application/json"
    '{"product_id": 3, "quantity": 2 }'
    https://{API_HOST}/api/v1/contact-order/1/contact-order-item

Form Data

Response

{
    "data": {
        "id": 2,
        "quantity": 1,
        "total_price_before_discounts": "3100.00",
        "total_discount": "0.00",
        "total_price_after_discounts": "3100.00",
        "product_id": 3,
        "contact_order_id": 1,
        "product":
        {
            "id": 3,
            "name": "女款 Dunk 低筒鞋 Medium Olive",
            "sku": "DD1503-120",
            "price": 3100,
        },
        "created_at": "2024-09-27 15:44:03",
        "updated_at": "2024-09-27 15:44:03"
    }
}

更新

PUT https://{API_DOMAIN}/api/v1/contact-order/{contact_order}/contact-order-item/{contact_order_item}
curl -X PUT
    -H "Content-Type: application/json"
    '{"product_id": 3, "quantity": 2 }'
    https://{API_HOST}/api/v1/contact-order/1/contact-order-item/36

Last updated