Skip to content

Batch API

ใช้ POST /api/batch เพื่อส่งหลายคำขอพร้อมกันใน request เดียว

Terminal window
curl -X POST http://localhost:3000/api/batch \
-H "Authorization: Bearer <JWT>" \
-H "Content-Type: application/json" \
-d '{
"requests": [
{ "method": "POST", "url": "/api/collections/posts/records", "body": { "title": "First" } },
{ "method": "PATCH", "url": "/api/collections/posts/records/123", "body": { "published": true } }
]
}'
  • อนุญาตเฉพาะ path ภายใน /api/collections/... (ป้องกัน path traversal และห้ามเรียกซ้อน /api/batch)
  • คงสิทธิ์ผู้ใช้และ Client IP จริงในทุก sub-request