Batch Insert RPC Adapter
API Contract
REST
/api/v1/batch-inserts
5 endpoints
GET
/api/v1/batch-inserts/api/v1/batch-inserts
List batch insert operations
Public
Response Example
{
"data": [
{
"id": "batch-001",
"record_count": 4,
"status": "completed",
"inserted_count": 3,
"failed_count": 1,
"created_at": "2026-03-22T10:00:00Z"
}
],
"pagination": {
"page": 1,
"limit": 20,
"total": 5
}
}
GET
/api/v1/batch-inserts/api/v1/batch-inserts/:id
Get batch insert operation details including per-record results
Public
Response Example
{
"id": "batch-001",
"record_count": 4,
"status": "completed",
"inserted_count": 3,
"failed_count": 1,
"results": [
{
"index": 0,
"activity_id": "pa-010",
"status": "success"
},
{
"index": 1,
"activity_id": "pa-011",
"status": "success"
},
{
"index": 2,
"activity_id": null,
"status": "failed",
"error": "unique_constraint_violation"
},
{
"index": 3,
"activity_id": "pa-013",
"status": "success"
}
],
"created_at": "2026-03-22T10:00:00Z",
"completed_at": "2026-03-22T10:00:02Z"
}
POST
/api/v1/batch-inserts/api/v1/batch-inserts
Execute a batch insert of serialized activity payloads via RPC (serializeBatchPayload + handleConstraintViolation internally)
Public
Request Example
{
"activities": [
{
"coordinator_id": "coord-42",
"mentor_id": "mentor-17",
"activity_type": "group_workshop",
"activity_date": "2026-03-28",
"duration_minutes": 120
},
{
"coordinator_id": "coord-42",
"mentor_id": "mentor-18",
"activity_type": "group_workshop",
"activity_date": "2026-03-28",
"duration_minutes": 120
}
]
}
Response Example
{
"id": "batch-002",
"record_count": 2,
"status": "completed",
"inserted_count": 2,
"failed_count": 0,
"results": [
{
"index": 0,
"activity_id": "pa-020",
"status": "success"
},
{
"index": 1,
"activity_id": "pa-021",
"status": "success"
}
]
}
PUT
/api/v1/batch-inserts/api/v1/batch-inserts/:id
Retry specific failed records within a batch insert
Public
Request Example
{
"retry_indices": [
2
],
"ignore_constraints": false
}
Response Example
{
"id": "batch-001",
"status": "completed",
"inserted_count": 4,
"failed_count": 0,
"updated_at": "2026-03-22T10:05:00Z"
}
DELETE
/api/v1/batch-inserts/api/v1/batch-inserts/:id
Delete a batch insert operation record
Public
Response Example
{
"message": "Batch insert record batch-001 deleted successfully"
}