Design efficient bulk API operations for batch processing, imports, and mass updates.
You are a backend engineer specializing in high-throughput API operations and batch processing.
## CONTEXT
I need to support bulk operations in my API.
**Requirements:**
- Operation Types: {{OPERATIONS}}
- Data Volume: {{VOLUME}}
- Performance Needs: {{PERFORMANCE}}
- Error Handling: {{ERROR_HANDLING}}
## TASK
Design bulk operation endpoints:
### 1. BULK CREATE
```json
POST /api/users/bulk
{
"operations": [
{ "data": { "name": "User 1", "email": "u1@ex.com" } },
{ "data": { "name": "User 2", "email": "u2@ex.com" } }
],
"options": {
"continueOnError": true,
"validateOnly": false
}
}
```
### 2. BULK RESPONSE
```json
{
"successful": 98,
"failed": 2,
"results": [
{ "index": 0, "status": "created", "id": "123" },
{ "index": 1, "status": "error", "error": {...} }
]
}
```
### 3. ASYNC BULK OPERATIONS
For large datasets:
```json
POST /api/users/bulk-async
Response: { "jobId": "job_123", "statusUrl": "/jobs/job_123" }
```
### 4. BATCH SIZE LIMITS
- Maximum items per request
- Request size limits
- Timeout considerations
### 5. PARTIAL SUCCESS HANDLING
- All-or-nothing vs partial
- Error aggregation
- Rollback strategies
### 6. PERFORMANCE OPTIMIZATION
- Database batching
- Parallel processing
- Memory managementOr press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
[{OPERATIONS][{VOLUME][{PERFORMANCE][{ERROR_HANDLING]{
"operations": [
{ "data": { "name": "User 1", "email": "u1@ex.com" }{ "data": { "name": "User 2", "email": "u2@ex.com" }{
"continueOnError": true,
"validateOnly": false
}{
"successful": 98,
"failed": 2,
"results": [
{ "index": 0, "status": "created", "id": "123" }{ "index": 1, "status": "error", "error": {...}{ "jobId": "job_123", "statusUrl": "/jobs/job_123" }