2.7 KiB
2.7 KiB
Cable Connections Bulk Operations - Quick Reference
🚀 Quick Start
Bulk Create
POST /cable-connections/bulk/create
{
"connections": [
{
"from_device_id": "uuid",
"to_device_id": "uuid",
"cable_length": 150.5,
"cable_type": "fiber_optic",
"status": "active"
}
]
}
Bulk Update
PUT /cable-connections/bulk/update
{
"connection_ids": ["uuid1", "uuid2"],
"updates": {
"status": "maintenance"
}
}
Bulk Delete
DELETE /cable-connections/bulk/delete
{
"connection_ids": ["uuid1", "uuid2", "uuid3"]
}
📊 Response Format
{
"total_requested": 10,
"successful": 8,
"failed": 2,
"errors": [
{
"index": 3,
"error": "Device not found",
"details": "..."
}
],
"results": [...],
"execution_time": "250ms"
}
✅ Validation
Cable Types
PTP_SFP_BLDPTP_SFP_DUPLEXBB_MONEVfiber_opticdrop_cable
Status Values
activeinactivemaintenanceplanned
Limits
- Max items per request: 100
- Min cable length: 0.1m
- Batch processing: 50 items
🔐 Authorization
Requires role: Teknisi | Admin | Super Admin
⚡ Performance
- 4-10x faster than individual operations
- Optimal batch size: 20-50 items
- Transaction-safe operations
📝 Example Usage
PowerShell (Windows)
$body = @{
connections = @(
@{
from_device_id = "uuid1"
to_device_id = "uuid2"
cable_length = 150.5
cable_type = "fiber_optic"
status = "active"
}
)
} | ConvertTo-Json
Invoke-RestMethod -Uri "http://localhost:8080/cable-connections/bulk/create" `
-Method POST `
-Headers @{
"Authorization" = "Bearer $token"
"Content-Type" = "application/json"
} `
-Body $body
cURL (Linux/Mac)
curl -X POST http://localhost:8080/cable-connections/bulk/create \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"connections": [
{
"from_device_id": "uuid1",
"to_device_id": "uuid2",
"cable_length": 150.5,
"cable_type": "fiber_optic",
"status": "active"
}
]
}'
🔧 Common Use Cases
- Initial Import: Bulk create from external systems
- Maintenance Mode: Bulk update status to 'maintenance'
- Data Cleanup: Bulk delete obsolete connections
- Cable Upgrades: Bulk update cable types
- Network Expansion: Bulk create new connections
📚 Documentation
- Full Guide:
BULK_OPERATIONS_GUIDE.md - Summary:
BULK_OPERATIONS_SUMMARY.md - Test Examples:
test_data/cable_connections_bulk_test_examples.js