取消訂單
接口信息
接口: POST /api/v1/orders/{order_id}/cancel
描述: 取消一個已創建且未成交的訂單
鑑權: Authorization請求頭附加JWT令牌
請求參數
| 字段 | 類型 | 必填 | 說明 |
|---|---|---|---|
| order_id | uuid | 是 | 訂單id(路由參數) |
響應參數
| 字段 | 類型 | 說明 |
|---|---|---|
| success | bool | 取消是否成功 |
| order_id | uuid | 訂單id |
| message | string | 結果描述 |
請求示例
bash
curl -X POST "/api/v1/orders/550e8400-e29b-41d4-a716-446655440000/cancel" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
-H "Content-Type: application/json"響應示例
json
{
"code": 0,
"data": {
"success": true,
"order_id": "550e8400-e29b-41d4-a716-446655440000",
"message": "Order cancelled successfully"
}
}