Keboola import API

Import operations

OpenAPI Specification

keboola-import-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  title: AI Service Actions import API
  version: 1.0.0
  contact:
    email: devel@keboola.com
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
  description: Import operations
tags:
- name: import
  description: Import operations
paths:
  /write-table:
    post:
      summary: Import data to a table
      operationId: writeTable
      tags:
      - import
      description: 'Import CSV data to an existing table in Storage. Use the Storage API to create [buckets](https://keboola.docs.apiary.io/#reference/buckets/create-or-list-buckets/create-bucket) and [tables](https://keboola.docs.apiary.io/#reference/tables/create-table-asynchronously/create-new-table-from-csv-file-asynchronously).

        '
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              required:
              - tableId
              - data
              properties:
                data:
                  type: string
                  format: binary
                  description: CSV data
                tableId:
                  type: string
                  example: in.c-main.my-table
                  description: Id of an existing table in Storage
                branchId:
                  type: string
                  example: '1234'
                  description: Id of the development branch in Storage. If not set, data will be imported into default branch.
                incremental:
                  type: boolean
                  example: false
                  description: Turns on [incremenal loading](https://help.keboola.com/storage/tables/#incremental-loading)
                columns[]:
                  type: array
                  items:
                    type: string
                  example:
                  - col1
                  - col2
                  description: Columns of the table. If not specified, the first row of the CSV is assumed to be header. If specified, the CSV is assumed to be headless. Due to [bug](https://github.com/swagger-api/swagger-ui/issues/5106) in Swagger, this is incorrectly handled in **Try it out**. Columns should be encoded as `columns[]=col1&columns[]=col2`. Due to Swagger [bug](https://github.com/swagger-api/swagger-ui/issues/5303) the empty column field is added to the request, while it must not be present at all
                delimiter:
                  type: string
                  example: '|'
                  default: ','
                  description: CSV data delimiter
                enclosure:
                  type: string
                  example: '"'
                  default: '"'
                  description: CSV data enclosure
                escapedBy:
                  type: string
                  example: \
                  default: null
                  description: CSV data enclosure escape character, if not present a double enclosure is assumed for escaping.
            encoding:
              columns[]:
                style: form
                explode: true
      responses:
        '200':
          description: Table Resource
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TableResource'
        default:
          description: Error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /upload-file:
    post:
      summary: Upload a file to Storage Files
      operationId: uploadFile
      tags:
      - import
      description: 'Upload a file to Storage Files

        '
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              required:
              - data
              properties:
                data:
                  type: string
                  format: binary
                  description: Uploaded file
                branchId:
                  type: string
                  example: '1234'
                  description: Id of the development branch in Storage. If not set, data will be imported into default branch.
                tags[]:
                  type: array
                  items:
                    type: string
                  example:
                  - tag1
                  - tag2
                  description: Due to [bug](https://github.com/swagger-api/swagger-ui/issues/5106) in Swagger, this is incorrectly handled in **Try it out**. Tags should be encoded as `tags[]=tag1&tags[]=tag2`
                isPublic:
                  type: boolean
                  example: false
                  description: When true, the file will be accessible on the returned URL for anyone
                isPermanent:
                  type: boolean
                  example: false
                  description: When false, the file will expire after 180 days
                notify:
                  type: boolean
                  example: false
                  description: When true, memebers of the project will be notified of the file upload
            encoding:
              tags[]:
                style: form
                explode: true
          application/x-www-form-urlencoded:
            schema:
              type: object
              required:
              - data
              - name
              properties:
                data:
                  type: string
                  example: Some data
                  description: File data
                name:
                  type: string
                  example: file-name.txt
                  description: File name
                tags[]:
                  type: array
                  items:
                    type: string
                  example:
                  - tag1
                  - tag2
                  description: Due to [bug](https://github.com/swagger-api/swagger-ui/issues/5106) in Swagger, this is incorrectly handled in **Try it out**. Tags should be encoded as `tags[]=tag1&tags[]=tag2`
                isPublic:
                  type: boolean
                  example: false
                  description: When true, the file will be accessible on the returned URL for anyone
                isPermanent:
                  type: boolean
                  example: false
                  description: When false, the file will expire after 180 days
                notify:
                  type: boolean
                  example: false
                  description: When true, memebers of the project will be notified of the file upload
            encoding:
              tags[]:
                style: form
                explode: true
      responses:
        '200':
          description: File Resource
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileResource'
        default:
          description: Error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    FileResource:
      type: object
      properties:
        id:
          type: integer
          example: 537806841
        created:
          type: string
          format: date-time
          example: 2019-09-18T17:43:13+0200
        isPublic:
          type: boolean
          example: false
        isSliced:
          type: boolean
          example: false
        isEncrypted:
          type: boolean
          example: true
        name:
          type: string
          example: my-file.zip
        url:
          type: string
          example: https://kbc-sapi-files.s3.amazonaws.com/exp-180/123/files/2019/09/18/537806841.my-file.zip?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ZZZ&X-Amz-Date=20190918T154315Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Signature=ZZZ
        provider:
          type: string
          example: aws
        region:
          type: string
          example: us-east-1
        sizeBytes:
          type: integer
          example: 1234
        tags:
          type: array
          items:
            type: string
          example:
          - my-tag1
          - my-tag2
        maxAgeDays:
          type: integer
          example: 180
        runId:
          type: integer
          example: null
        runIds:
          type: array
          items:
            type: integer
          example: []
        creatorToken:
          type: object
          required:
          - id
          - description
          properties:
            id:
              type: integer
              example: 1234
            description:
              type: string
              example: My API token
    TableResource:
      type: object
      properties:
        transaction:
          type: string
          example: null
        warnings:
          type: array
          items:
            type: string
          example: []
        importedColumns:
          type: array
          items:
            type: string
          example:
          - col1
          - col2
        totalRowsCount:
          type: integer
          example: 1234
        totalDataSizeBytes:
          type: integer
          example: 12345678
    Error:
      type: object
      required:
      - message
      - status
      properties:
        message:
          type: string
          example: X-StorageApi-Token header is required
        status:
          type: string
          enum:
          - error
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-StorageApi-Token