BanQu Data Processors API

Automation workflows for custom formats import

OpenAPI Specification

banqu-data-processors-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: BanQu Data Processors 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: Data Processors
  description: Automation workflows for custom formats import
paths:
  /data-processors:
    get:
      description: List data processors
      tags:
      - Data Processors
      responses:
        '200':
          description: list of account's data processors
          content:
            application/json:
              schema:
                type: array
                items:
                  allOf:
                  - $ref: '#/components/schemas/DataProcessor'
                  - $ref: '#/components/schemas/ScimResourceMetadata'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
    post:
      description: Create data processor
      tags:
      - Data Processors
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DataProcessor'
      responses:
        '201':
          $ref: '#/components/responses/201'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
  /data-processors/{processorId}:
    parameters:
    - name: processorId
      description: Data processor identifier
      in: path
      schema:
        type: string
      required: true
    get:
      description: Get data processor details
      tags:
      - Data Processors
      responses:
        '200':
          description: Data processor details
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/DataProcessor'
                - $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 data processor
      tags:
      - Data Processors
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DataProcessor'
      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: Archive data processor
      tags:
      - Data Processors
      responses:
        '204':
          $ref: '#/components/responses/204'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
        '422':
          $ref: '#/components/responses/422'
  /data-processors/{processorId}/restore:
    parameters:
    - name: processorId
      description: Data processor identifier
      in: path
      schema:
        type: string
      required: true
    post:
      description: Restore data processor
      tags:
      - Data Processors
      responses:
        '204':
          $ref: '#/components/responses/204'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
        '422':
          $ref: '#/components/responses/422'
  /data-processors/{processorId}/validate:
    parameters:
    - name: processorId
      description: Data processor identifier
      in: path
      schema:
        type: string
      required: true
    post:
      description: Validate file
      tags:
      - Data Processors
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                s3FileKey:
                  type: string
                  description: Amazon S3 File Key
              additionalProperties: false
              required:
              - s3FileKey
      responses:
        '200':
          description: Validation Result
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DataProcessorResult'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
        '422':
          $ref: '#/components/responses/422'
  /data-processors/{processorId}/process:
    parameters:
    - name: processorId
      description: Data processor identifier
      in: path
      schema:
        type: string
      required: true
    post:
      description: Import and process file
      tags:
      - Data Processors
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                s3FileKey:
                  type: string
                  description: Amazon S3 File Key
                offset:
                  type: number
                  description: The input offset
              additionalProperties: false
              required:
              - s3FileKey
      responses:
        '200':
          description: Validation Result
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DataProcessorResult'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
        '422':
          $ref: '#/components/responses/422'
  /data-processors/{processorId}/stop:
    parameters:
    - name: processorId
      description: Data processor identifier
      in: path
      schema:
        type: string
      required: true
    post:
      description: Stop processing file
      tags:
      - Data Processors
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                s3FileKey:
                  type: string
                  description: Amazon S3 File Key
              additionalProperties: false
              required:
              - s3FileKey
      responses:
        '200':
          content:
            application/json:
              schema:
                type: object
                properties:
                  stopped:
                    type: boolean
        '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"
    '400':
      description: "HTTP 400 - Bad Request \nThe request is formatted incorrectly, most likely some of the required parameters are missed"
    '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"
    '403':
      description: "HTTP 403 - Forbidden \nNot authorized to access selected resource"
  schemas:
    Attachment:
      type: object
      additionalProperties: false
      properties:
        downloadUrl:
          type: string
          format: url
        fileName:
          type: string
          minLength: 1
        fileSize:
          type: number
          minimum: 0
        mimeType:
          type: string
          minLength: 1
          example: image/jpeg
        md5:
          type: string
          minLength: 32
          maxLength: 32
          pattern: ^[a-f0-9]{32}$
      required:
      - downloadUrl
    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_]*$
    JsonSchema:
      title: JSON Schema
      description: https://json-schema.org/draft-07/schema#
      type: object
      properties:
        title:
          type: string
        description:
          type: string
        type:
          type: string
          enum:
          - array
          - boolean
          - integer
          - 'null'
          - number
          - object
          - string
          example: object
        required:
          type: array
          items:
            type: string
          uniqueItems: true
        additionalProperties:
          oneOf:
          - type: boolean
          - type: object
        properties:
          type: object
      example:
        type: object
        properties:
          field1:
            type: string
        required:
        - field1
        additionalProperties: false
    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
    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
    DataProcessor:
      type: object
      additionalProperties: false
      properties:
        title:
          type: string
          description: Data processor title
        description:
          type:
          - string
          - 'null'
        sample:
          oneOf:
          - $ref: '#/components/schemas/Attachment'
          - type: 'null'
        workflow:
          type: object
          additionalProperties: false
          properties:
            parser:
              oneOf:
              - $ref: '#/components/schemas/DataProcessorXlsxParser'
              - $ref: '#/components/schemas/DataProcessorCsvParser'
            steps:
              $ref: '#/components/schemas/WorkflowSteps'
          required:
          - parser
          - steps
        ownerId:
          type: string
          readOnly: true
    DataProcessorXlsxParser:
      type: object
      title: XLSX Parser Configuration
      additionalProperties: false
      properties:
        type:
          type: string
          enum:
          - xlsx
        config:
          type: object
          additionalProperties: false
          properties:
            sheetNamingPattern:
              type: string
              enum:
              - js-safe
              - original
              - indexes
              default: js-safe
            defaultSheet:
              type: string
            ignoreHidden:
              type: boolean
              default: true
            ignoreHiddenRows:
              type: boolean
              default: true
            ignoreHiddenColumns:
              type: boolean
              default: true
            ignoreHiddenTabs:
              type: boolean
              default: true
            ignoreBlank:
              type: boolean
              default: true
            linesToSkip:
              type: number
              default: 0
            timeForChunk:
              type: number
            containsHeader:
              type: boolean
              default: true
            parseDirection:
              type: string
              enum:
              - top-to-bottom
              - left-to-right
            schema:
              $ref: '#/components/schemas/JsonSchema'
            sheets:
              type: object
              additionalProperties:
                type: object
                additionalProperties: false
                properties:
                  linesToSkip:
                    type: number
                    default: 0
                  containsHeader:
                    type: boolean
                    default: true
                  parseDirection:
                    type: string
                    enum:
                    - top-to-bottom
                    - left-to-right
                  schema:
                    $ref: '#/components/schemas/JsonSchema'
      required:
      - type
      - config
    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_]*$
    DataProcessorResult:
      type: object
      properties:
        items:
          type: number
          description: Total items in the main input array
        processed:
          type: number
          description: Total items processed
        stats:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
                title: Step Name
              input:
                type: string
                title: Step Source Name
              count:
                type: number
                title: Step Successful Executions Number
              errors:
                type: object
                title: Step Execution Failures
                properties:
                  total:
                    type: number
                  groups:
                    type: array
                    items:
                      type: object
                      properties:
                        message:
                          type: string
                        items:
                          type: array
                          items:
                            type: object
                            properties:
                              message:
                                type: string
                              source:
                                type: object
                              total:
                                type: number
    DataProcessorCsvParser:
      type: object
      title: CSV Parser Configuration
      additionalProperties: false
      properties:
        type:
          type: string
          enum:
          - csv
        config:
          type: object
          properties:
            linesToSkip:
              type: number
              default: 0
            timeForChunk:
              type: number
              default: 20
            containsHeader:
              type: boolean
              default: true
            parseDirection:
              type: string
              enum:
              - top-to-bottom
              - left-to-right
            schema:
              $ref: '#/components/schemas/JsonSchema'
            separator:
              type: string
      required:
      - type
      - config
    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
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Your authentication token