OpenAPI Spezifikation für Prozess Aktionen, Prozess Starter, Prozessstatuswechsel und Mehrfach-Aktionen

openapi: 3.1.1
info:
  title: Monitor Backend Services API
  version: 1.0.0
  description: |
    This REST API specification defines the interfaces for backend services that can be connected to the monitor.
    The aim is to provide backend services with a standardized connection to the monitor.
    Every service that is connected via this API must implement the endpoints described 
    and support the structures defined in the payload.

paths:
  /monitor/startAction:
    post:
      summary: Start monitor action
      description: |
        Starts an action (process starter, process action or status change).
        The behavior depends on "config.type":
        - "processStarter": starts a new process with optional "parameters".
        - "processAction": executes an action on existing processes.
        - "statusChange": changes a status field for processes.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ActionPayload"
            examples:
              processStarter:
                summary: Example for a process starter
                value:
                  bpcUrl: "bpc://flow/flow_iguasu/endpointOrProcessor"
                  config:
                    id: "sendOrders"
                    label: "Place an order"
                    type: "processStarter"
                    instanceId: "process-starter-with-role"
                    parameters:
                      receiver: "Number 1"
                      itemnumber: "Number 2"
                      positions:
                        - id: "extModel409-1"
                          itemnumbertable: "Nummer 1"
                          quantity: 1
                        - id: "extModel409-2"
                          itemnumbertable: "Nummer 2"
                          quantity: 2
                  metadata:
                    process: "sendOrders"
                    key: "itemnumber"
                    operation: "choiceList"
                    reloadOnChange: true
              processAction:
                summary: Example for a process action
                value:
                  bpcUrl: "bpc://flow/flow_iguasu/endpointOrProcessor"
                  config:
                    id: "action-requires-comments"
                    label: "Action Requires Comments"
                    type: "processAction"
                    column: "action_test"
                    comment: "Comment"
                    requireComment: true
                    requireConfirmation: true
                    instanceId: "process-actions-test-monitor-notifications"
                  records:
                    - action_test: "[{\"id\":\"simple-action\",\"name\":\"A Simple Action\"}]"
                      id: "1"
                      text: "requireConfirmation true"
                      _id: "1"
                      bpccleanedid: "_1"
                    - action_test: "[{\"id\":\"action-requires-comments\",\"name\":\"Action Requires Comments\"}]"
                      id: "2"
                      text: "requireConfirmation true requireComment true"
                      _id: "2"
                      bpccleanedid: "_2"
                  metadata:
                    foo: "bar"
              statusChange:
                summary: Example for a status change
                value:
                  bpcUrl: "bpc://flow/flow_iguasu/endpointOrProcessor"
                  config:
                    type: "statusChange"
                    column: "status"
                    newStatus: "inprocess"
                    timelineUpdate: "TIMESTAMP"
                    comment: "Start processing"
                    processes: "extModel8836-1"
                    instanceId: "change-status-test-monitor"
                  metadata:
                    childStatus: "Info"
              bulkAction:
                summary: Example for a bulk action
                value:
                  bpcUrl: "bpc://flow/flow_iguasu/endpointOrProcessor"
                  config:
                    type: "bulkAction"
                    id: "fetchUpdates"
                    label: {de: "Updates abrufen", en: "Fetch Updates"}
                    iconCls: "x-fal fa-sync"
                    filter: "[]"
                    instanceId: "bulk-action-test-monitor"
                    query: ""
                    requireConfirmation: true
                    sortValue: 1
                    timezoneName: "Europe/Berlin"
                    timezoneOffset: "+02:00"
                    tooltip: "Manuelle Aktualisierung der Daten"
                    view: "allView"
                    dataLimit: 10000
                  metadata:
                    foo: "bar"
      responses:
        "200":
          description: Successful action result.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ActionResult"
        "400":
          description: Bad request.
        "401":
          description: Unauthorized.
        "403":
          description: Forbidden.
        "500":
          description: Internal server error.

components:
  schemas:
    ActionPayload:
      type: object
      required:
        - bpcUrl
        - config
      properties:
        bpcUrl:
          type: string
          description: BPC URL that contains a reference to the backend service and the processor or endpoint in use.
        config:
          type: object
          description: Generic configuration map, must include "id", "instanceId", and "type". Other keys are allowed.
          properties:
            id:
              type: string
              description: Action identifier.
            instanceId:
              type: string
              description: Monitor module instance ID.
            type:
              type: string
              enum: [processStarter, processAction, statusChange, bulkAction]
              description: The type of action (e.g. "processStarter", "statusChange", "processAction", "bulkAction").
            name:
              type: string
            iconCls:
              type: string
            sortValue:
              type: integer
            requireComment:
              type: boolean
            requireConfirmation:
              type: boolean
            label:
              oneOf:
                - type: string
                  description: A simple, non-internationalized label.
                - type: object
                  description: An internationalized label, with language codes as keys.
            column:
              type: string
            comment:
              type: string
            parameters:
              type: object
              description: |
                Additional input parameters for the process starter.
                May contain arbitrary keys and nested structures.
              additionalProperties: true
            newStatus:
              type: string
              description: New status to set for type = "statusChange".
            timelineUpdate:
              type: string
              description: How to update the timeline (e.g. timestamp field name) for type = "statusChange".
            processes:
              type: string
              description: One or more process identifiers for type = "statusChange" separated by semicolons.
            filter:
              type: string
              description: Filter criteria for the bulk action.
            query:
              type: string
              description: Search string for the bulk action.
            timezoneName:
              type: string
              description: The IANA timezone name (e.g., "Europe/Berlin") for the bulk action.
            timezoneOffset:
              type: string
              description: The timezone offset from UTC (e.g., "+02:00") for the bulk action.
            tooltip:
              type: string
              description: Tooltip text for the action.
            view:
              type: string
              description: The name of the view where the action originated.
            dataLimit:
              type: integer
              description: The maximum number of records the action should affect for the bulk action.
          additionalProperties: true
        records:
          type: array
          items:
            type: object
            additionalProperties: true
          description: |
            List of records related to the action.
            Each record is an object with arbitrary keys.
        metadata:
          type: object
          additionalProperties: true
          description: Optional metadata for the action.

    ActionResult:
      type: object
      properties:
        success:
          type: boolean
          description: Indicates if the action was successful.
        message:
          type: string
          description: Human-readable message.
        data:
          type: object
          nullable: true
          description: Optional result data.
        referenceId:
          type: string
          nullable: true
          description: Optional reference ID for tracking.