MATIH Platform is in active MVP development. Documentation reflects current implementation status.
8. Platform Services
Bulk Operations

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.yaml

Export Parameters

ParameterDefaultDescription
environmentrequiredTarget environment
formatYAMLExport format: YAML or JSON
includeFlagstrueInclude feature flags
includeMetadatatrueInclude version, timestamps
keyPatternsallFilter 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

ModeDescription
UPSERTCreate new entries and update existing ones
CREATE_ONLYOnly create new entries, skip existing
UPDATE_ONLYOnly update existing entries, skip new
REPLACEDelete 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}"