# درخواست و پاسخ‌های ضبط‌شده — درس AUT-201-L01

> **داده ساختگی.** خروجی واقعی API آزمایشی برگ سبز (`shared/barg-sabz-mock-api.py`) که با curl گرفته شده است. هدر Date و X-Request-Id در هر اجرا فرق می‌کند.

## تبادل 1

```bash
curl -i http://127.0.0.1:8787/health
```

```http
HTTP/1.0 200 OK
Date: Thu, 15 Oct 2026 23:36:34 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 16
X-Request-Id: req_c2a2e63a6059

{"status": "ok"}

```

## تبادل 2

```bash
curl -i http://127.0.0.1:8787/orders/BS-1001
```

```http
HTTP/1.0 401 Unauthorized
Date: Thu, 15 Oct 2026 23:36:34 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 81
X-Request-Id: req_5b4860f0ebe6

{"error": {"code": "unauthorized", "message": "missing or invalid bearer token"}}

```

## تبادل 3

```bash
curl -i -H 'Authorization: Bearer local-demo-token' http://127.0.0.1:8787/orders/BS-1001
```

```http
HTTP/1.0 200 OK
Date: Thu, 15 Oct 2026 23:36:34 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 193
X-Request-Id: req_c87fb9b859d2

{"id": "BS-1001", "status": "shipped", "carrier": "post", "items": [{"title": "کتاب نمونه یک", "qty": 1}], "total": 420000, "currency": "toman", "updated_at": "2026-10-10T09:30:00Z"}

```

## تبادل 4

```bash
curl -i -H 'Authorization: Bearer local-demo-token' http://127.0.0.1:8787/orders/BS-9999
```

```http
HTTP/1.0 404 Not Found
Date: Thu, 15 Oct 2026 23:36:34 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 69
X-Request-Id: req_52b837d40c79

{"error": {"code": "order_not_found", "message": "no order BS-9999"}}

```

## تبادل 5

```bash
curl -i -H 'Authorization: Bearer local-demo-token' -H 'Content-Type: application/json' -d '{"customer_ref":"C-01","category":"order_shipping","text":"سفارشم کجاست؟"}' http://127.0.0.1:8787/tickets
```

```http
HTTP/1.0 201 Created
Date: Thu, 15 Oct 2026 23:36:34 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 145
X-Request-Id: req_e8a0f00ab334

{"id": "T-0001", "customer_ref": "C-01", "category": "order_shipping", "text": "سفارشم کجاست؟", "created_at": "2026-10-15T23:36:34Z"}

```

## تبادل 6

```bash
curl -i -H 'Authorization: Bearer local-demo-token' -H 'Content-Type: application/json' -d '{"customer_ref":"C-01"}' http://127.0.0.1:8787/tickets
```

```http
HTTP/1.0 400 Bad Request
Date: Thu, 15 Oct 2026 23:36:34 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 98
X-Request-Id: req_ed62c96f2b0c

{"error": {"code": "validation_error", "message": "missing or non-string fields: category, text"}}

```
