Bulk Operations
The Bulk Import/Export system enables mass configuration management through file-based operations. The BulkImportExportController at /api/v1/config/bulk supports YAML and JSON formats with dry-run validation, comparison reports, and multiple import modes.
Export Configurations
Export all configurations for a tenant environment to YAML or JSON format.
Endpoint: GET /api/v1/config/bulk/export
curl "http://localhost:8888/api/v1/config/bulk/export?environment=production&format=YAML&includeFlags=true&includeMetadata=true" \
-H "Authorization: Bearer ${TOKEN}" \
-H "X-Tenant-ID: 550e8400-e29b-41d4-a716-446655440000" \
-o config-export-production.yamlExport Parameters
| Parameter | Default | Description |
|---|---|---|
environment | required | Target environment |
format | YAML | Export format: YAML or JSON |
includeFlags | true | Include feature flags |
includeMetadata | true | Include version, timestamps |
keyPatterns | all | Filter by key patterns |
Import from File
Upload a YAML or JSON file to import configurations.
Endpoint: POST /api/v1/config/bulk/import
curl -X POST http://localhost:8888/api/v1/config/bulk/import \
-H "Authorization: Bearer ${TOKEN}" \
-H "X-Tenant-ID: 550e8400-e29b-41d4-a716-446655440000" \
-H "X-User-ID: 550e8400-e29b-41d4-a716-446655440001" \
-H "X-User-Email: admin@acme.com" \
-F "file=@config-import.yaml" \
-F "environment=staging" \
-F "mode=UPSERT" \
-F "dryRun=true"Import Modes
| Mode | Description |
|---|---|
UPSERT | Create new entries and update existing ones |
CREATE_ONLY | Only create new entries, skip existing |
UPDATE_ONLY | Only update existing entries, skip new |
REPLACE | Delete all existing configs and replace with import |
Dry Run
Set dryRun=true to validate the import without making any changes. The response will show what would be created, updated, or skipped.
Import Inline
Import configurations from the request body instead of a file upload.
Endpoint: POST /api/v1/config/bulk/import/inline
curl -X POST http://localhost:8888/api/v1/config/bulk/import/inline \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${TOKEN}" \
-H "X-Tenant-ID: 550e8400-e29b-41d4-a716-446655440000" \
-H "X-User-ID: 550e8400-e29b-41d4-a716-446655440001" \
-H "X-User-Email: admin@acme.com" \
-d '{
"content": "configs:\n - key: query.timeout\n value: 60s\n - key: ai.model\n value: gpt-4",
"format": "YAML",
"environment": "staging",
"mode": "UPSERT",
"dryRun": false
}'Validate Import
Validate import content without applying it.
Endpoint: POST /api/v1/config/bulk/validate
curl -X POST http://localhost:8888/api/v1/config/bulk/validate \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${TOKEN}" \
-d '{
"content": "configs:\n - key: query.timeout\n value: 60s",
"format": "YAML"
}'Compare Import with Existing
Compare the import content against existing configurations to see what would change.
Endpoint: POST /api/v1/config/bulk/compare
curl -X POST http://localhost:8888/api/v1/config/bulk/compare \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${TOKEN}" \
-H "X-Tenant-ID: 550e8400-e29b-41d4-a716-446655440000" \
-d '{
"content": "...",
"format": "YAML",
"environment": "production"
}'Get Import Template
Download a template file showing the expected format.
Endpoint: GET /api/v1/config/bulk/template
curl "http://localhost:8888/api/v1/config/bulk/template?format=YAML&includeExamples=true" \
-H "Authorization: Bearer ${TOKEN}"