# 예약 명세 조정(쓰기; 소유권 확인)

`PATCH /api/v1/reservations/{reservation_id}` — 토큰 필요 · pdstock:write · 쓰기 · 2포인트

재고 예약

## 경로 파라미터

| 이름 | 타입 | 설명 |
| --- | --- | --- |
| `reservation_id` **필수** | string | 예약번호, 예약 목록에서 확인. 본인 채널만(조회/조정). (최대 길이 64) |

## 요청 본문(JSON)

| 필드 | 타입 | 설명 |
| --- | --- | --- |
| `lines` **필수** | array<object> | 명세 배열, 각 { sku, quantity }. 최소 1건; 예약 조정 시 quantity=0 은 해당 행 삭제. (1–1000) |
| `lines[].sku` **필수** | string | SKU / 바코드 — **색상 + 사이즈** 단위, 예: OB0021611. 스타일 전체는 product_code 를 쓰세요. (최대 길이 64) |
| `lines[].quantity` **필수** | integer | 수량(양의 정수, 예: 2). 예약 조정 / 장바구니에서 0 은 해당 행 삭제. (0–99999) |
| `note` | string | 비고(선택, 최대 500자). (최대 길이 500) |

## 응답

봉투는 HTTP 상태 코드만으로 판단합니다: 2xx 는 `{ data: … }`(목록은 `page / page_size / has_more` 또는 `total_count` 포함); 4xx / 5xx 는 `{ error: { code, message, hint, request_id, doc_url } }`.

```json
{
  "data": { … }
}
```

성공 응답에는 사람이 읽는 문구가 없습니다 — `code / result / msg` 없음. 프로그램이 분기해야 할 필드는 `error.code` 뿐이며 `message` 는 `Accept-Language` 를 따릅니다.

> 쓰기 요청에는 `Idempotency-Key` 헤더(UUID 등 고유 문자열)를 보내세요. 네트워크 재시도로 주문이 두 번 생기지 않습니다. 주문은 ERP에서 사람이 확인하기 전까지 초안입니다.

## 예제

### curl

```bash
curl -X PATCH "https://connect.everugg.net.au/api/v1/reservations/{reservation_id}" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: <uuid>" \
  -d '{ "lines": [ { "sku": "OB0021611", "quantity": 2 } ] }'
```

### Python

```python
import requests

r = requests.patch(
    "https://connect.everugg.net.au/api/v1/reservations/{reservation_id}",
    headers={"Authorization": "Bearer " + TOKEN, "Idempotency-Key": str(uuid.uuid4())},
    json={
      "lines": [
        {
          "sku": "OB0021611",
          "quantity": 2
        }
      ]
    },
)
data = r.json()
r.raise_for_status()  # 4xx/5xx: data["error"]["code"] / ["hint"]
```

### Node

```js
const res = await fetch("https://connect.everugg.net.au/api/v1/reservations/{reservation_id}", {
  method: "PATCH",
  headers: { Authorization: `Bearer ${TOKEN}`, "Content-Type": "application/json", "Idempotency-Key": crypto.randomUUID() },
  body: JSON.stringify({
    "lines": [
      {
        "sku": "OB0021611",
        "quantity": 2
      }
    ]
  }),
})
const data = await res.json()
if (!res.ok) throw new Error(`${data.error?.code}: ${data.error?.message}`)
```

### Java

```java
HttpRequest req = HttpRequest.newBuilder()
    .uri(URI.create("https://connect.everugg.net.au/api/v1/reservations/{reservation_id}"))
    .header("Authorization", "Bearer " + token)
    .header("Content-Type", "application/json")
    .header("Idempotency-Key", UUID.randomUUID().toString())
    .PATCH(HttpRequest.BodyPublishers.ofString("{ \"lines\": [ { \"sku\": \"OB0021611\", \"quantity\": 2 } ] }"))
    .build();
HttpResponse<String> res = HttpClient.newHttpClient().send(req, HttpResponse.BodyHandlers.ofString());
```

---
Markdown 원본: https://connect.everugg.net.au/reference/patch-api-v1-reservations-reservation-id.md?lang=ko · 웹 페이지: https://connect.everugg.net.au/reference?op=patch-api-v1-reservations-reservation-id&lang=ko
