Skip to content

WorkflowController.cs

ASP.NET Core API controller for UpDoc workflow CRUD operations.

/umbraco/management/api/v1/updoc/workflows

MethodPathDescription
GET/Returns all workflow summaries
GET/activeReturns document type aliases and blueprint IDs with complete workflows
GET/{name}Returns full configuration for a specific workflow (bypasses validation)
POST/Creates a new workflow folder with stub files + auto-populates destination.json
DELETE/{name}Deletes a workflow folder
POST/{name}/sample-extractionExtracts content from a source (PDF, Markdown, or Web URL) and saves as sample extraction. For markdown/web sources, also auto-generates transform.json via ConvertStructuredToTransformResult (deterministic heading-based grouping)
GET/{name}/sample-extractionReturns the saved sample extraction
POST/{name}/regenerate-destinationRegenerates destination.json from the blueprint
PUT/{name}/mapSaves updated map.json
POST/{name}/transformRuns area detection and content transform on the workflow’s sample extraction
GET/{name}/transformReturns the saved transform result
POST/{name}/transform-adhocRuns extract + transform against a media item or URL for a specific workflow (used by Create from Source modal)
PUT/{alias}/transform/sort-orderUpdates sort order of areas or sections in transform.json
GET/by-alias/{alias}Returns full configuration for a workflow matching a source type alias (per-workflow config for document creation)

GET /{name} — Direct config loading with auto-regeneration

Section titled “GET /{name} — Direct config loading with auto-regeneration”

Uses GetConfigByName(name) which loads the workflow config directly from disk without running validation. This is important because validation rejects workflows with partially-complete mappings (e.g., mappings referencing aliases that haven’t been fully wired yet). The workspace editor needs to load these in-progress configs.

After loading, the endpoint always regenerates destination.json from the current blueprint content. This ensures the Destination tab reflects the latest blueprint state (block ordering, property changes, etc.) without requiring manual regeneration. If regeneration fails, the cached file on disk is used as a fallback.

  • IWorkflowService — handles workflow file operations, config loading, and validation
  • IDestinationStructureService — builds destination.json from blueprint content
  • IPdfPagePropertiesService — detects areas in PDFs via DetectAreas()
  • IContentTransformService — assembles area detection into sections via Transform()
  • IMediaService — resolves media file paths
  • IWebHostEnvironment — provides web root path for file resolution

A companion controller at /umbraco/management/api/v1/updoc/document-types provides endpoints for the Create Workflow modal pickers:

MethodPathDescription
GET/Returns all non-element document types (alias, name, icon, id)
GET/{alias}/blueprintsReturns blueprints for a given document type
  • IContentTypeService — Umbraco core service for document type lookups
  • IContentService — Umbraco core service for blueprint lookups

All endpoints require BackOfficeAccess authorization policy. Frontend calls must include a bearer token from UMB_AUTH_CONTEXT.

  • up-doc-workflows-view.element.ts — CRUD operations on workflows
  • create-workflow-sidebar.element.ts — document type and blueprint picker data
  • workflow.service.ts — fetches active workflows, full configs, sample extractions, and saves map configs
  • up-doc-workflow-source-view.element.ts — sample extraction trigger and retrieval