BanQu Validation Workflows API

Automation workflows for custom validations on any write API actions

OpenAPI Specification

banqu-validation-workflows-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: BanQu Validation Workflows API
  version: 3.3.4
  description: The BanQu API is organized around [REST](http://en.wikipedia.org/wiki/Representational_State_Transfer). Our API is designed to have predictable, resource-oriented URLs and to use HTTP response codes to indicate API errors. We use built-in HTTP features, like HTTP verbs, which can be understood by off-the-shelf HTTP clients, and [JSON](http://www.json.org) for input and output.
servers:
- url: https://banqu.app:443/api/v1
security:
- Bearer: []
tags:
- name: Validation Workflows
  description: Automation workflows for custom validations on any write API actions
paths:
  /validation-workflows:
    get:
      description: List validation workflows
      tags:
      - Validation Workflows
      responses:
        '200':
          description: list of account's validation workflows
          content:
            application/json:
              schema:
                type: array
                items:
                  allOf:
                  - $ref: '#/components/schemas/ValidationWorkflowSummary'
                  - type: object
                    properties:
                      description:
                        type: string
                  - $ref: '#/components/schemas/ScimResourceMetadata'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
    post:
      description: Create validation workflow
      tags:
      - Validation Workflows
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ValidationWorkflowDetails'
      responses:
        '201':
          $ref: '#/components/responses/201'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
  /validation-workflows/{workflowId}:
    parameters:
    - name: workflowId
      description: Validation workflow identifier
      in: path
      schema:
        type: string
      required: true
    get:
      description: Get validation workflow details
      tags:
      - Validation Workflows
      responses:
        '200':
          description: Validation workflow details
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/ValidationWorkflowDetails'
                - $ref: '#/components/schemas/ScimResourceMetadata'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
        '404':
          $ref: '#/components/responses/404'
    put:
      description: Update validation workflow
      tags:
      - Validation Workflows
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ValidationWorkflowDetails'
      responses:
        '204':
          $ref: '#/components/responses/204'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
        '422':
          $ref: '#/components/responses/422'
    delete:
      description: Deactivate validation workflow
      tags:
      - Validation Workflows
      responses:
        '204':
          $ref: '#/components/responses/204'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
        '422':
          $ref: '#/components/responses/422'
  /validation-workflows/{workflowId}/restore:
    parameters:
    - name: workflowId
      description: Validation workflow identifier
      in: path
      schema:
        type: string
      required: true
    post:
      description: Reactivate validation workflow
      tags:
      - Validation Workflows
      responses:
        '204':
          $ref: '#/components/responses/204'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
        '422':
          $ref: '#/components/responses/422'
components:
  responses:
    '404':
      description: "HTTP 404 - Not Found \nRequested resource could not be found"
    '201':
      description: HTTP 201 - Created
      headers:
        Location:
          schema:
            type: string
          description: Url of the created entity
    '401':
      description: "HTTP 401 - Unauthorized \nUser is not authenticated or session has expired"
    '204':
      description: "HTTP 204 - No Content \nThe request has been processed, but no content will be provided in response"
    '422':
      description: "HTTP 422 - Unprocessable Request \nThe server understands the content type of the request entity and the syntax of the request is correct, but was unable to process the contained instructions"
    '400':
      description: "HTTP 400 - Bad Request \nThe request is formatted incorrectly, most likely some of the required parameters are missed"
    '403':
      description: "HTTP 403 - Forbidden \nNot authorized to access selected resource"
  schemas:
    WorkflowStepName:
      type:
      - string
      - 'null'
      description: Optional unique alpha-numeric name of the step. Data produced during the step execution can be referred by this name
      pattern: ^[a-zA-Z_$][\da-zA-Z_]*$
    ScimResourceMetadata:
      type: object
      readOnly: true
      properties:
        displayName:
          type: string
          readOnly: true
        meta:
          type: object
          properties:
            resourceType:
              type: string
              readOnly: true
            created:
              type: number
              readOnly: true
            lastModified:
              type: number
              readOnly: true
          required:
          - resourceType
          - created
          - lastModified
      required:
      - displayName
      - meta
    WorkflowSteps:
      title: Workflow Steps
      type: array
      items:
        oneOf:
        - $ref: '#/components/schemas/WorkflowMapping'
        - $ref: '#/components/schemas/WorkflowFilter'
        - $ref: '#/components/schemas/WorkflowUniquenessFilter'
        - $ref: '#/components/schemas/WorkflowAction'
        - $ref: '#/components/schemas/WorkflowRequest'
      example:
      - type: filter
        condition: selectedAssetId !== '' && receiverId !== ''
      - type: map
        mapping:
          map:
            assetId: selectedAssetId
            body:
              map:
                receiverId: receiverId
                qty: '1'
                destinationId: 'null'
                price: '0'
                priceCurrency: '''USD'''
      - type: action
        action: eyJwYXRoIjoiL2Fzc2V0cy97YXNzZXRJZH0vdHJhbnNmZXJzIiwibWV0aG9kIjoicG9zdCJ9
    WorkflowFilter:
      title: Workflow Filter
      type: object
      additionalProperties: false
      properties:
        name:
          $ref: '#/components/schemas/WorkflowStepName'
        input:
          $ref: '#/components/schemas/WorkflowStepInput'
        type:
          type: string
          enum:
          - filter
        condition:
          type: string
          description: JS expression in a 'filter' step that returns `true` or `false` to indicate if execution should proceed
      required:
      - type
      - condition
    ImmutableId:
      type: string
      readOnly: true
      minLength: 32
      maxLength: 32
      example: '00000000000000000000000000000000'
    WorkflowRequest:
      title: Workflow Request
      type: object
      additionalProperties: false
      properties:
        name:
          $ref: '#/components/schemas/WorkflowStepName'
        input:
          $ref: '#/components/schemas/WorkflowStepInput'
        type:
          type: string
          enum:
          - request
        method:
          type: string
          enum:
          - get
          - list
          - post
          - put
          - patch
          - delete
          - head
          - options
        url:
          type: string
        headers:
          type: object
          additionalProperties:
            type: string
      required:
      - type
      - method
      - url
    Mapping:
      type: object
      properties:
        from:
          type: string
          description: Context source to map data from
        forEach:
          type: string
          description: Array context source to map data from
        map:
          type: object
          description: Object fields mapping
      additionalProperties: true
      example:
        map:
          outputField: inputField
    ValidationWorkflowDetails:
      type: object
      additionalProperties: false
      properties:
        title:
          type: string
          description: Validation workflow title
        description:
          type: string
          description: Validation workflow description
        authToken:
          type: string
          description: Optional auth token to use for workflow authentication. Write-only property
        authTokenSig:
          type: string
          description: Signature of the stored auth token for its presence and uniqueness validation
          readOnly: true
        workflow:
          type: object
          additionalProperties: false
          properties:
            validatedActionId:
              type: string
            steps:
              $ref: '#/components/schemas/WorkflowSteps'
          required:
          - validatedActionId
          - steps
        ownerId:
          type: string
          readOnly: true
        authenticatedAs:
          type: object
          description: Display name of identity & account under which workflow runs with provided authToken
          readOnly: true
          properties:
            user:
              type: string
              description: User display name
              readOnly: true
            account:
              type: string
              description: Account display name
              readOnly: true
      required:
      - title
      - workflow
    WorkflowAction:
      title: Workflow Action
      type: object
      additionalProperties: false
      properties:
        name:
          $ref: '#/components/schemas/WorkflowStepName'
        input:
          $ref: '#/components/schemas/WorkflowStepInput'
        type:
          type: string
          enum:
          - action
        action:
          type: string
          description: ID of the Open API endpoint to execute. Base64 encoded JSON object containing endpint properties `{ method, path }`
      required:
      - type
      - action
    WorkflowStepInput:
      type:
      - string
      - 'null'
      description: Name of one of the previous steps that should be used as a primary input. By default the latest step name is used
      pattern: ^[a-zA-Z_$][\da-zA-Z_]*$
    WorkflowUniquenessFilter:
      title: Workflow Uniqueness Filter
      type: object
      additionalProperties: false
      properties:
        name:
          $ref: '#/components/schemas/WorkflowStepName'
        input:
          $ref: '#/components/schemas/WorkflowStepInput'
        type:
          type: string
          enum:
          - unique
        criteria:
          type: string
          description: JS expression in a 'unique' step that returns a key used to identify object uniquenss
      required:
      - type
      - criteria
    WorkflowMapping:
      title: Workflow Mapping
      type: object
      additionalProperties: false
      properties:
        name:
          $ref: '#/components/schemas/WorkflowStepName'
        input:
          $ref: '#/components/schemas/WorkflowStepInput'
        type:
          type: string
          enum:
          - map
        mapping:
          $ref: '#/components/schemas/Mapping'
      required:
      - type
      - mapping
    ValidationWorkflowSummary:
      type: object
      additionalProperties: false
      properties:
        id:
          $ref: '#/components/schemas/ImmutableId'
        title:
          type: string
          description: Validation workflow title
          readOnly: true
        description:
          type: string
          description: Validation workflow description
          readOnly: true
        ownerId:
          type: string
          readOnly: true
        owner:
          type: object
          readOnly: true
          properties:
            id:
              type: string
              readOnly: true
            displayName:
              type: string
              readOnly: true
      required:
      - title
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Your authentication token