REST API reference

This page details the TDK REST API endpoints available.

openapi: 3.0.1
info:
  title: "Testing suite common API"
  description: |
    Test
  version: "0.1"

x-package: io.synthesized.api

paths:
  /api/v1/ping:
    get:
      operationId: ping
      responses:
        "200":
          description: OK

  /api/v1/license-expiration:
    description: gets license expiration date
    get:
      operationId: getLicenseExpirationDate
      tags:
        - license
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LicenseExpiration'

  /api/v1/validate-connection:
    description: validate connection
    post:
      operationId: validateConnection
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DatabaseConnection'
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationResult'

  /api/v1/validate-workflow:
    description: validate workflow
    post:
      operationId: validateWorkflow
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                validateWorkflowRequest:
                  $ref: '#/components/schemas/ValidateWorkflowRequest'
                config:
                  type: string
                  format: binary
            encoding:
              runWorkflowRequest:
                contentType: application/json
              config:
                contentType: application/octet-stream
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationResult'

  /api/v1/workflow-run:
    description: run workflow
    post:
      operationId: runWorkflow
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                runWorkflowRequest:
                  $ref: '#/components/schemas/RunWorkflowRequest'
                config:
                  type: string
                  format: binary
                  nullable: true
            encoding:
              runWorkflowRequest:
                contentType: application/json
              config:
                contentType: application/octet-stream
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RunWorkflowResponse'

  /api/v1/workflow/{id}/stop:
    description: stop workflow
    post:
      operationId: stopWorkflow
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
            format: int64
            nullable: false
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StopWorkflowResponse'

  /api/v1/workflow-run/{id}/stop:
    description: stop workflowRun
    post:
      operationId: stopWorkflowRun
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
            format: int64
            nullable: false
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StopWorkflowResponse'

  /api/v1/workflow-run/{id}:
    description: get workflow run
    get:
      operationId: getWorkflowRun
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
            format: int64
            nullable: false
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RunWorkflowResponse'

  /api/v1/workflow/{workflow_id}/runs:
    description: get workflow runs
    get:
      operationId: listWorkflowRuns
      parameters:
        - name: workflow_id
          in: path
          required: true
          schema:
            type: integer
            format: int64
            nullable: false
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                nullable: false
                items:
                  $ref: '#/components/schemas/RunWorkflowResponse'

components:
  schemas:
    TableConfigRequest:
      nullable: false
      type: object
      properties:
        input_connection:
          $ref: '#/components/schemas/DatabaseConnection'
        config:
          nullable: false
          type: string

    TableConfig:
      description: "[TableConfig] is equivalent to [UserTableConfig] but with all parameters must set,
       it doesn't accept null values."
      type: object
      nullable: false
      x-extends:
        - java.io.Serializable
      properties:
        table:
          $ref: "#/components/schemas/Table"
        mode:
          $ref: "userconfig.yaml#/components/schemas/TransformationMode"
        transformations:
          type: array
          items:
            $ref: "userconfig.yaml#/components/schemas/ColumnTransformationParams"
          nullable: false
        target_ratio:
          type: number
          format: double
          nullable: true
        target_row_number:
          type: integer
          format: int64
          nullable: true
        cycle_breaker_references:
          type: array
          nullable: false
          items:
            type: string
            nullable: false
          default: [ ]
        target_count:
          type: integer
          format: int64
          nullable: false
          default: 0
        insert_batch_size:
          type: integer
          nullable: false
        use_working_directory:
          type: boolean
          nullable: false
          default: true
        filter:
          type: string
        in_memory_filter_threshold:
          type: integer
          nullable: false

    DataType:
      type: object
      title: DataTypeDTO
      nullable: false
      x-extends:
        - java.io.Serializable
      properties:
        type_name:
          type: string
          nullable: false
        sql_type_name:
          type: string
          default: 'null'
        length:
          type: integer
          default: 'null'
        precision:
          type: integer
          default: 'null'
        scale:
          type: integer
          default: 'null'
        nullable:
          type: boolean
          default: true
          nullable: false
        is_user_defined:
          type: boolean
          nullable: false
          default: false
        has_explicit_size:
          description: "If the value is false, a datatype doesn't have explicit scale, precision or length in a
            SQL definition"
          type: boolean
          nullable: false
          default: true

    Field:
      type: object
      title: Field
      x-extends:
        - java.io.Serializable
      properties:
        name:
          type: string
          nullable: false
        database_id:
          type: string
          nullable: false
        database_name:
          type: string
          nullable: true
          default: null
        schema:
          type: string
        table:
          type: string
          nullable: false
        data_type:
          $ref: "#/components/schemas/DataType"
        external_meta:
          $ref: "#/components/schemas/ExternalFieldMeta"

    ForeignKey:
      type: object
      title: ForeignKey
      x-extends:
        - java.io.Serializable
      properties:
        database_id:
          type: string
          nullable: false
        database_name:
          type: string
          nullable: true
          default: null
        schema:
          type: string
        table:
          type: string
          nullable: false
        name:
          type: string
          nullable: false
        fields:
          type: array
          items:
            type: string
          nullable: false
        referred_name:
          type: string
          nullable: true
        referred_database_id:
          type: string
          nullable: false
        referred_database_name:
          type: string
          nullable: true
          default: null
        referred_schema:
          type: string
        referred_table:
          type: string
        referred_fields:
          type: array
          items:
            type: string
          nullable: false
        meta_source:
          $ref: "#/components/schemas/MetaSource"

    PrimaryKey:
      type: object
      title: PrimaryKey
      x-extends:
        - java.io.Serializable
      properties:
        database_id:
          type: string
          nullable: false
        database_name:
          type: string
          nullable: true
          default: null
        schema:
          type: string
        table:
          type: string
          nullable: false
        name:
          type: string
          nullable: false
        fields:
          type: array
          items:
            type: string
          nullable: false

    UniqueKey:
      type: object
      title: UniqueKey
      x-extends:
        - java.io.Serializable
      properties:
        database_id:
          type: string
          nullable: false
        database_name:
          type: string
          nullable: true
          default: null
        schema:
          type: string
        table:
          type: string
          nullable: false
        name:
          type: string
          nullable: false
        fields:
          type: array
          items:
            type: string
          nullable: false

    Procedure:
      type: object
      title: Procedure
      nullable: false
      x-extends:
        - java.io.Serializable
      properties:
        name:
          type: string
          nullable: false
        schema:
          type: string

    Function:
      type: object
      title: Procedure
      nullable: false
      x-extends:
        - java.io.Serializable
      properties:
        name:
          type: string
          nullable: false
        schema:
          type: string
    UserType:
      type: object
      title: User type
      nullable: false
      x-extends:
        - java.io.Serializable
      properties:
        name:
          type: string
          nullable: false
        schema:
          type: string

    Table:
      type: object
      title: Table
      nullable: false
      x-extends:
        - java.io.Serializable
      properties:
        name:
          type: string
          nullable: false
        fields:
          type: array
          items:
            $ref: '#/components/schemas/Field'
          nullable: false
        database_id:
          type: string
          nullable: false
        database_name:
          type: string
          nullable: true
          default: null
        schema:
          type: string
        indexes:
          type: array
          items:
            type:
              string
          nullable: false
          default: []
        primary_key:
          $ref: "#/components/schemas/PrimaryKey"
        foreign_keys:
          type: array
          items:
            $ref: '#/components/schemas/ForeignKey'
          nullable: false
          default: []
        unique_keys:
          type: array
          items:
            $ref: '#/components/schemas/UniqueKey'
          nullable: false
          default: []
        identity_column:
          description: >
            The name of IDENTITY column, if this table has one, null otherwise.
          type: string
          nullable: true
          default: null
        external_meta:
          $ref: "#/components/schemas/ExternalTableMeta"

    SQLDialect:
      enum:
        - POSTGRES
        - MYSQL
        - MARIADB
        - SQLITE
        - ORACLE
        - MSSQL
        - H2
        - DB2
        - SNOWFLAKE

    Database:
      type: object
      title: Database
      properties:
        id:
          description: "Database Id"
          type: string
          nullable: false
        name:
          description: "Database name (if exists)"
          type: string
          nullable: true
          default: null
        dialect:
          $ref: "#/components/schemas/SQLDialect"
        schemas:
          type: array
          nullable: false
          items:
            type: string
        tables:
          description: "Tables in the database"
          type: array
          nullable: false
          items:
            $ref: "#/components/schemas/Table"
          default: []
        triggers:
          type: array
          nullable: false
          items:
            type: string
          default: []
        views:
          type: array
          nullable: false
          items:
            type: string
          default: []
        procedures:
          description: "Procedures in the database"
          type: array
          nullable: false
          items:
            $ref: "#/components/schemas/Procedure"
          default: [ ]
        functions:
          description: "Functions in the database"
          type: array
          nullable: false
          items:
            $ref: "#/components/schemas/Function"
          default: [ ]
        user_types:
          description: "User types in the database"
          type: array
          nullable: false
          items:
            $ref: "#/components/schemas/UserType"
          default: [ ]
        users:
          type: array
          nullable: false
          items:
            type: string
          default: []

    ApiCallError:
      type: object
      properties:
        message:
          type: string
          nullable: false
        details:
          type: array
          nullable: false
          items:
            type: string
          default: []

    ValidationResult:
      type: object
      title: ValidationResultDTO
      nullable: false
      properties:
        failed:
          type: boolean
          nullable: false
        messages:
          type: array
          nullable: false
          items:
            type: string
          default: []

    RunWorkflowRequest:
      type: object
      title: RunWorkflowRequest
      nullable: false
      properties:
        input_connection:
          $ref: '#/components/schemas/DatabaseConnection'
        output_connection:
          $ref: '#/components/schemas/DatabaseConnection'
        workflow_id:
          nullable: false
          type: integer
          format: int64
        workflow_name:
          nullable: false
          type: string
        user_id:
          type: integer
          format: int64
        user_name:
          type: string

    ValidateWorkflowRequest:
      type: object
      title: RunWorkflowRequest
      nullable: false
      properties:
        input_connection:
          $ref: '#/components/schemas/DatabaseConnection'
        output_connection:
          $ref: '#/components/schemas/DatabaseConnection'

    DatabaseConnection:
      type: object
      title: DatabaseConnection
      nullable: false
      properties:
        jdbc_url:
          type: string
          nullable: false
        user:
          $ref: 'inventory.yaml#/components/schemas/Credentials'
        password:
          $ref: 'inventory.yaml#/components/schemas/Credentials'
        sql_dialect:
          $ref: '#/components/schemas/SQLDialect'
        spawned_id:
          description: Spawned database UUID (if this database is temporary)
          type: string

    StopWorkflowResponse:
      type: object
      title: StopWorkflowResponse
      nullable: false
      properties:
        message:
          nullable: false
          type: string
        stop_workflow_run_response:
          $ref: '#/components/schemas/StopWorkflowRunResponse'

    StopWorkflowRunResponse:
      type: object
      title: StopWorkflowResponse
      nullable: true
      properties:
        workflow_id:
          type: integer
          format: int64
        workflow_run_id:
          nullable: false
          type: integer
          format: int64
        workflow_run_status:
          $ref: '#/components/schemas/WorkflowRunStatus'
        start_date:
          type: string
          format: date-time
          example: "2021-01-30T08:30:00Z"
        end_date:
          type: string
          format: date-time
          example: "2021-01-30T08:30:00Z"
        user_id:
          type: integer
          format: int64
        user_name:
          type: string
        error_message:
          type: string
        steps:
          description: "Workflow run steps info"
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/WorkflowRunStep"
          default: null

    RunWorkflowResponse:
      type: object
      title: RunWorkflowResponse
      nullable: false
      properties:
        workflow_run_id:
          nullable: false
          type: integer
          format: int64
        workflow_run_status:
          $ref: '#/components/schemas/WorkflowRunStatus'
        start_date:
          type: string
          format: date-time
          example: "2021-01-30T08:30:00Z"
        end_date:
          type: string
          format: date-time
          example: "2021-01-30T08:30:00Z"
        user_id:
          type: integer
          format: int64
        user_name:
          type: string
        error_message:
          type: string
        steps:
          description: "Workflow run steps info"
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/WorkflowRunStep"
          default: null

    WorkflowStatusRequest:
      type: object
      title: WorkflowStatusRequest
      nullable: false
      properties:
        ids:
          type: array
          nullable: false
          items:
            type: integer
            format: int64
          default: [ ]

    WorkflowStatusResponse:
      type: object
      title: WorkflowStatusResponse
      nullable: false
      properties:
        workflow_id:
          nullable: false
          type: integer
          format: int64
        workflow_run_status:
          $ref: '#/components/schemas/WorkflowRunStatus'

    WorkflowRunStep:
      type: object
      title: WorkflowRunStep
      nullable: false
      properties:
        workflow_run_step_id:
          nullable: true
          type: integer
          format: int64
        workflow_run_id:
          nullable: true
          type: integer
          format: int64
        name:
          $ref: '#/components/schemas/WorkflowRunStepName'
        workflow_run_step_status:
          $ref: '#/components/schemas/WorkflowRunStatus'
        total_time_millis:
          nullable: true
          type: integer
          format: int64

    WorkflowRunStatus:
      enum:
        - QUEUED
        - RUNNING
        - COMPLETED
        - FAILED
        - STOPPING
        - STOPPED

    WorkflowRunStepName:
      enum:
        - VALIDATION
        - SCHEMA_COPY
        - TRUNCATION
        - TRANSFORMATION
        - STOPPING

    LicenseExpiration:
      nullable: false
      type: object
      properties:
        expiry_date:
          type: string
          format: date

    ExternalFieldMeta:
      nullable: true
      default: null
      type: object
      properties:
        classifiers:
          type: array
          nullable: false
          items:
            type: string
          default: []

    ExternalTableMeta:
      nullable: true
      default: null
      type: object
      properties:
        sensitivity_tags:
          type: array
          nullable: false
          items:
            $ref: "#/components/schemas/SensitivityTag"
          default: []

    SensitivityTag:
      nullable: true
      type: object
      properties:
        group:
          type: string
          nullable: false
        level:
          type: string
          nullable: false

    MetaSource:
      nullable: false
      enum:
        - DATABASE
        - CONFIG

    AgentExecutionStatus:
      enum:
        - ACQUIRED
        - QUEUED
        - RUNNING
        - DONE
        - FAILED