Skip to content

REST API v2 and GitOps

Piergiorgio Lucidi edited this page Nov 26, 2026 · 1 revision

REST API v2 & Configuration-as-Code (GitOps)

Available in 2.32-SNAPSHOT (trunk) via the Spring Boot 4.2 executable WAR (framework/spring-boot-app). For the classic servlet API (/mcf-api-service/json/*) and Authority Service (/mcf-authority-service/UserACLs), see Programmatic Operation (REST API v1).

Overview

REST API v2 (/api/v2/*) modernizes programmatic management of Apache ManifoldCF with:

  • Predictable REST semantics & HTTP status codes (200 OK, 201 Created, 204 No Content, 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found, 409 Conflict).
  • OpenAPI 3.x specification & interactive Swagger UI powered by springdoc-openapi.
  • RFC 9457 Problem Details (application/problem+json) error responses across all endpoints.
  • HTTP Basic Authentication wired directly into ManifoldCF's IAuth / IAuthorizer capability model.
  • Secret masking: Obfuscated connector parameters are automatically masked on read and export responses.
  • Declarative Configuration-as-Code (GitOps): Export/import complete ManifoldCF topologies in YAML or JSON with ${ENV_VAR} placeholder substitution and --dryRun planning.

Authentication & OpenAPI Discovery

Authentication

All /api/v2/*, /mcf-api-service/swagger-ui, and non-health /actuator/* endpoints enforce HTTP Basic Authentication against org.apache.manifoldcf.apilogin.name / org.apache.manifoldcf.apilogin.password (falling back to UI credentials, default admin / admin in example setups):

curl -u admin:admin http://localhost:8345/api/v2/metrics
  • Open health probe: GET /api/v2/health and GET /actuator/health are unauthenticated for Kubernetes/Docker liveness and readiness checks.
  • Browser XHR clients: Passing X-Requested-With: XMLHttpRequest suppresses the WWW-Authenticate: Basic challenge header on 401 responses (while still returning HTTP 401 + RFC 9457 JSON) so single-page web UIs handle invalid credentials inline without triggering native browser auth popups.

OpenAPI 3 & Swagger UI

  • Swagger UI: http://localhost:8345/mcf-api-service/swagger-ui
  • OpenAPI JSON: GET /api/v2/openapi
  • OpenAPI YAML: GET /api/v2/openapi.yaml

RFC 9457 Error Payload Example

{
  "type": "urn:apache:manifoldcf:api:v2:error:401",
  "title": "Unauthorized",
  "status": 401,
  "detail": "Invalid API credentials."
}

Endpoint Reference

1. System, Health, Metrics & Current User (SystemV2Controller)

Method Path Auth Description
GET /api/v2/health Open Service liveness status, ManifoldCF version, virtual-threads flag, timestamp
GET /api/v2/metrics Required Resource counts across all connection types & jobs plus JVM memory/CPU/thread metrics
GET /api/v2/auth/me Required Authenticated username and effective IAuthorizer UI/API capabilities

2. Connector Metadata (ConnectionsV2Controller)

Method Path Description
GET /api/v2/connectors/{connectorType} List installed connector classes for repository, output, transformation, authority, mapping, or notification
GET /api/v2/authorization-domains List registered authorization domains

3. Connections & Authority Groups (ConnectionsV2Controller)

Supported resource collections:

  • repository-connections
  • output-connections
  • transformation-connections
  • authority-connections
  • authority-groups
  • mapping-connections
  • notification-connections
Method Path Description
GET /api/v2/{collection} List all resources of this type (secrets masked)
POST /api/v2/{collection} Create a new resource (201 Created, 409 Conflict if name exists)
GET /api/v2/{collection}/{name} Fetch single resource by URL-encoded name
PUT /api/v2/{collection}/{name} Idempotent create-or-update (upsert)
DELETE /api/v2/{collection}/{name} Delete resource (204 No Content)
GET /api/v2/{collection}/{name}/status Live connector health check (Connection working or diagnostic error; all types except authority-groups)

Maintenance Actions:

Method Path Description
POST /api/v2/repository-connections/{name}/clear-history Clear activity history records for a repository connection
POST /api/v2/output-connections/{name}/clear-versions Forget indexed document versions (forces re-ingestion on next crawl)
POST /api/v2/output-connections/{name}/clear-history (alias .../remove-all) Remove all recorded output ingestion tracking entries

4. Crawl Jobs & Lifecycle Control (JobsV2Controller)

Method Path Description
GET /api/v2/jobs List all job definitions
GET /api/v2/jobs/statuses List live execution statuses for all jobs (queued, active, processed, state, error text)
POST /api/v2/jobs Create a new crawl job (201 Created)
GET /api/v2/jobs/{id} Get job definition
PUT /api/v2/jobs/{id} Update job definition
DELETE /api/v2/jobs/{id} Initiate asynchronous job deletion (204 No Content)
GET /api/v2/jobs/{id}/status Get live status for a single job
POST /api/v2/jobs/{id}/start Start crawl job
POST /api/v2/jobs/{id}/start-minimal Start minimal crawl
POST /api/v2/jobs/{id}/stop Abort / stop running job
POST /api/v2/jobs/{id}/pause Pause running job
POST /api/v2/jobs/{id}/resume Resume paused job
POST /api/v2/jobs/{id}/restart Restart job
POST /api/v2/jobs/{id}/restart-minimal Restart minimal crawl
POST /api/v2/jobs/{id}/reseed Reset seeding state for incremental crawl

5. Status & History Reports (ReportsV2Controller)

All report endpoints enforce strict sortcolumn allowlist validation.

Method Path Key Query Parameters
GET /api/v2/reports/activities/{connectionName} Lists available history activity names for filtering
GET /api/v2/reports/queue/{connectionName} report=document|status, startrow, rowcount, sortcolumn, sortcolumn_direction, job, idmatch, idmatch_insensitive, statematch (repeatable), statusmatch (repeatable), idbucket, now
GET /api/v2/reports/history/{connectionName} report=simple|maxactivity|maxbandwidth|result, startrow, rowcount, sortcolumn, sortcolumn_direction, starttime, endtime, activity (repeatable), entitymatch, entitymatch_insensitive, resultcodematch, resultcodematch_insensitive, idbucket, resultcodebucket, interval

6. Dynamic Connector UI Bridge (ConnectorUiV2Controller)

Enables headless or modern web frontends to render and submit native connector Velocity/JSP configuration and job specification tabs cleanly as JSON:

Method Path Description
POST /api/v2/connector-ui/connection/render Render native configuration tab HTML/JS for a connector class and config params
POST /api/v2/connector-ui/connection/process Process submitted form parameters through the connector's native processConfigurationPost
POST /api/v2/connector-ui/connection/view Render read-only native configuration summary HTML
POST /api/v2/connector-ui/job/render Render native job specification tab HTML/JS for repository, transformation, output, or notification stage
POST /api/v2/connector-ui/job/process Process submitted job form parameters through the connector's native processSpecificationPost
POST /api/v2/connector-ui/job/view Render read-only native job specification summary HTML

7. Configuration-as-Code / GitOps (ConfigV2Controller)

Method Path Description
GET /api/v2/config/export?format=yaml|json Export complete topology (authority groups, all connection types, and jobs) as YAML or JSON with secrets masked
POST /api/v2/config/import?dryRun=true|false Validate (dryRun=true) or idempotently apply (dryRun=false) a YAML or JSON manifest in dependency order

GitOps Workflow Examples

Export Current Topology to YAML

curl -fsS -u admin:admin \
  "http://localhost:8345/api/v2/config/export?format=yaml" \
  -o manifoldcf-topology.yaml

Environment Variable Secret Injection

Manifests support ${ENV_VAR} placeholders so secrets never need to be committed to Git:

apiVersion: v2
outputConnections:
  - name: Prod Solr
    class_name: org.apache.manifoldcf.agents.output.solr.SolrConnector
    max_connections: "10"
    configuration:
      Server: solr.internal
      Password: "${SOLR_PASSWORD}"

Dry-Run Validation & Apply in CI/CD

# 1. Validate & preview planned creates/updates without mutating state
curl -fsS -u admin:admin \
  -H "Content-Type: application/yaml" \
  --data-binary @manifoldcf-topology.yaml \
  "http://localhost:8345/api/v2/config/import?dryRun=true"

# 2. Apply idempotently in dependency order
curl -fsS -u admin:admin \
  -H "Content-Type: application/yaml" \
  --data-binary @manifoldcf-topology.yaml \
  "http://localhost:8345/api/v2/config/import?dryRun=false"

Resources are reconciled automatically in dependency order:

  1. authorityGroups
  2. mappingConnections
  3. authorityConnections
  4. outputConnections
  5. transformationConnections
  6. notificationConnections
  7. repositoryConnections
  8. jobs

Related Pages

Clone this wiki locally