Apache Airflow Connection API

The Connection API from Apache Airflow — 4 operation(s) for connection.

OpenAPI Specification

airflow-connection-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Airflow Asset Connection API
  description: Airflow API. All endpoints located under ``/api/v2`` can be used safely, are stable and backward compatible. Endpoints located under ``/ui`` are dedicated to the UI and are subject to breaking change depending on the need of the frontend. Users should not rely on those but use the public ones instead.
  version: '2'
tags:
- name: Connection
paths:
  /api/v2/connections/{connection_id}:
    delete:
      tags:
      - Connection
      summary: Airflow Delete Connection
      description: Delete a connection entry.
      operationId: delete_connection
      security:
      - OAuth2PasswordBearer: []
      - HTTPBearer: []
      parameters:
      - name: connection_id
        in: path
        required: true
        schema:
          type: string
          title: Connection Id
      responses:
        '204':
          description: Successful Response
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPExceptionResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPExceptionResponse'
          description: Forbidden
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPExceptionResponse'
          description: Not Found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    get:
      tags:
      - Connection
      summary: Airflow Get Connection
      description: Get a connection entry.
      operationId: get_connection
      security:
      - OAuth2PasswordBearer: []
      - HTTPBearer: []
      parameters:
      - name: connection_id
        in: path
        required: true
        schema:
          type: string
          title: Connection Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConnectionResponse'
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPExceptionResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPExceptionResponse'
          description: Forbidden
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPExceptionResponse'
          description: Not Found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    patch:
      tags:
      - Connection
      summary: Airflow Patch Connection
      description: Update a connection entry.
      operationId: patch_connection
      security:
      - OAuth2PasswordBearer: []
      - HTTPBearer: []
      parameters:
      - name: connection_id
        in: path
        required: true
        schema:
          type: string
          title: Connection Id
      - name: update_mask
        in: query
        required: false
        schema:
          anyOf:
          - type: array
            items:
              type: string
          - type: 'null'
          title: Update Mask
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConnectionBody'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConnectionResponse'
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPExceptionResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPExceptionResponse'
          description: Forbidden
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPExceptionResponse'
          description: Bad Request
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPExceptionResponse'
          description: Not Found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /api/v2/connections:
    get:
      tags:
      - Connection
      summary: Airflow Get Connections
      description: Get all connection entries.
      operationId: get_connections
      security:
      - OAuth2PasswordBearer: []
      - HTTPBearer: []
      parameters:
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          minimum: 0
          default: 50
          title: Limit
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          minimum: 0
          default: 0
          title: Offset
      - name: order_by
        in: query
        required: false
        schema:
          type: array
          items:
            type: string
          description: 'Attributes to order by, multi criteria sort is supported. Prefix with `-` for descending order. Supported attributes: `conn_id, conn_type, description, host, port, id, team_name, connection_id`'
          default:
          - id
          title: Order By
        description: 'Attributes to order by, multi criteria sort is supported. Prefix with `-` for descending order. Supported attributes: `conn_id, conn_type, description, host, port, id, team_name, connection_id`'
      - name: connection_id_pattern
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: SQL LIKE expression — use `%` / `_` wildcards (e.g. `%customer_%`). or the pipe `|` operator for OR logic (e.g. `dag1 | dag2`). Regular expressions are **not** supported.
          title: Connection Id Pattern
        description: SQL LIKE expression — use `%` / `_` wildcards (e.g. `%customer_%`). or the pipe `|` operator for OR logic (e.g. `dag1 | dag2`). Regular expressions are **not** supported.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConnectionCollectionResponse'
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPExceptionResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPExceptionResponse'
          description: Forbidden
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPExceptionResponse'
          description: Not Found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    post:
      tags:
      - Connection
      summary: Airflow Post Connection
      description: Create connection entry.
      operationId: post_connection
      security:
      - OAuth2PasswordBearer: []
      - HTTPBearer: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConnectionBody'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConnectionResponse'
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPExceptionResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPExceptionResponse'
          description: Forbidden
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPExceptionResponse'
          description: Conflict
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    patch:
      tags:
      - Connection
      summary: Airflow Bulk Connections
      description: Bulk create, update, and delete connections.
      operationId: bulk_connections
      security:
      - OAuth2PasswordBearer: []
      - HTTPBearer: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BulkBody_ConnectionBody_'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BulkResponse'
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPExceptionResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPExceptionResponse'
          description: Forbidden
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /api/v2/connections/test:
    post:
      tags:
      - Connection
      summary: Airflow Test Connection
      description: 'Test an API connection.


        This method first creates an in-memory transient conn_id & exports that to an env var,

        as some hook classes tries to find out the `conn` from their __init__ method & errors out if not found.

        It also deletes the conn id env connection after the test.'
      operationId: test_connection
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConnectionBody'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConnectionTestResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPExceptionResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPExceptionResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
      - OAuth2PasswordBearer: []
      - HTTPBearer: []
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /api/v2/connections/defaults:
    post:
      tags:
      - Connection
      summary: Airflow Create Default Connections
      description: Create default connections.
      operationId: create_default_connections
      responses:
        '204':
          description: Successful Response
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPExceptionResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPExceptionResponse'
      security:
      - OAuth2PasswordBearer: []
      - HTTPBearer: []
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
components:
  schemas:
    BulkResponse:
      properties:
        create:
          anyOf:
          - $ref: '#/components/schemas/BulkActionResponse'
          - type: 'null'
          description: Details of the bulk create operation, including successful keys and errors.
        update:
          anyOf:
          - $ref: '#/components/schemas/BulkActionResponse'
          - type: 'null'
          description: Details of the bulk update operation, including successful keys and errors.
        delete:
          anyOf:
          - $ref: '#/components/schemas/BulkActionResponse'
          - type: 'null'
          description: Details of the bulk delete operation, including successful keys and errors.
      type: object
      title: BulkResponse
      description: 'Serializer for responses to bulk entity operations.


        This represents the results of create, update, and delete actions performed on entity in bulk.

        Each action (if requested) is represented as a field containing details about successful keys and any encountered errors.

        Fields are populated in the response only if the respective action was part of the request, else are set None.'
    BulkUpdateAction_ConnectionBody_:
      properties:
        action:
          type: string
          const: update
          title: Action
          description: The action to be performed on the entities.
        entities:
          items:
            $ref: '#/components/schemas/ConnectionBody'
          type: array
          title: Entities
          description: A list of entities to be updated.
        update_mask:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Update Mask
          description: A list of field names to update for each entity.Only these fields will be applied from the request body to the database model.Any extra fields provided will be ignored.
        action_on_non_existence:
          $ref: '#/components/schemas/BulkActionNotOnExistence'
          default: fail
      additionalProperties: false
      type: object
      required:
      - action
      - entities
      title: BulkUpdateAction[ConnectionBody]
    BulkActionNotOnExistence:
      type: string
      enum:
      - fail
      - skip
      title: BulkActionNotOnExistence
      description: Bulk Action to be taken if the entity does not exist.
    BulkBody_ConnectionBody_:
      properties:
        actions:
          items:
            oneOf:
            - $ref: '#/components/schemas/BulkCreateAction_ConnectionBody_'
            - $ref: '#/components/schemas/BulkUpdateAction_ConnectionBody_'
            - $ref: '#/components/schemas/BulkDeleteAction_ConnectionBody_'
          type: array
          title: Actions
      additionalProperties: false
      type: object
      required:
      - actions
      title: BulkBody[ConnectionBody]
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    BulkCreateAction_ConnectionBody_:
      properties:
        action:
          type: string
          const: create
          title: Action
          description: The action to be performed on the entities.
        entities:
          items:
            $ref: '#/components/schemas/ConnectionBody'
          type: array
          title: Entities
          description: A list of entities to be created.
        action_on_existence:
          $ref: '#/components/schemas/BulkActionOnExistence'
          default: fail
      additionalProperties: false
      type: object
      required:
      - action
      - entities
      title: BulkCreateAction[ConnectionBody]
    ConnectionResponse:
      properties:
        connection_id:
          type: string
          title: Connection Id
        conn_type:
          type: string
          title: Conn Type
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        host:
          anyOf:
          - type: string
          - type: 'null'
          title: Host
        login:
          anyOf:
          - type: string
          - type: 'null'
          title: Login
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Schema
        port:
          anyOf:
          - type: integer
          - type: 'null'
          title: Port
        password:
          anyOf:
          - type: string
          - type: 'null'
          title: Password
        extra:
          anyOf:
          - type: string
          - type: 'null'
          title: Extra
        team_name:
          anyOf:
          - type: string
          - type: 'null'
          title: Team Name
      type: object
      required:
      - connection_id
      - conn_type
      - description
      - host
      - login
      - schema
      - port
      - password
      - extra
      - team_name
      title: ConnectionResponse
      description: Connection serializer for responses.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
            - type: string
            - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
      - loc
      - msg
      - type
      title: ValidationError
    BulkDeleteAction_ConnectionBody_:
      properties:
        action:
          type: string
          const: delete
          title: Action
          description: The action to be performed on the entities.
        entities:
          items:
            anyOf:
            - type: string
            - $ref: '#/components/schemas/ConnectionBody'
          type: array
          title: Entities
          description: A list of entity id/key or entity objects to be deleted.
        action_on_non_existence:
          $ref: '#/components/schemas/BulkActionNotOnExistence'
          default: fail
      additionalProperties: false
      type: object
      required:
      - action
      - entities
      title: BulkDeleteAction[ConnectionBody]
    ConnectionBody:
      properties:
        connection_id:
          type: string
          maxLength: 200
          pattern: ^[\w.-]+$
          title: Connection Id
        conn_type:
          type: string
          title: Conn Type
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
        host:
          anyOf:
          - type: string
          - type: 'null'
          title: Host
        login:
          anyOf:
          - type: string
          - type: 'null'
          title: Login
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Schema
        port:
          anyOf:
          - type: integer
          - type: 'null'
          title: Port
        password:
          anyOf:
          - type: string
          - type: 'null'
          title: Password
        extra:
          anyOf:
          - type: string
          - type: 'null'
          title: Extra
        team_name:
          anyOf:
          - type: string
            maxLength: 50
          - type: 'null'
          title: Team Name
      additionalProperties: false
      type: object
      required:
      - connection_id
      - conn_type
      title: ConnectionBody
      description: Connection Serializer for requests body.
    BulkActionResponse:
      properties:
        success:
          items:
            type: string
          type: array
          title: Success
          description: A list of unique id/key representing successful operations.
          default: []
        errors:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Errors
          description: A list of errors encountered during the operation, each containing details about the issue.
          default: []
      type: object
      title: BulkActionResponse
      description: 'Serializer for individual bulk action responses.


        Represents the outcome of a single bulk operation (create, update, or delete).

        The response includes a list of successful keys and any errors encountered during the operation.

        This structure helps users understand which key actions succeeded and which failed.'
    HTTPExceptionResponse:
      properties:
        detail:
          anyOf:
          - type: string
          - additionalProperties: true
            type: object
          title: Detail
      type: object
      required:
      - detail
      title: HTTPExceptionResponse
      description: HTTPException Model used for error response.
    ConnectionTestResponse:
      properties:
        status:
          type: boolean
          title: Status
        message:
          type: string
          title: Message
      type: object
      required:
      - status
      - message
      title: ConnectionTestResponse
      description: Connection Test serializer for responses.
    ConnectionCollectionResponse:
      properties:
        connections:
          items:
            $ref: '#/components/schemas/ConnectionResponse'
          type: array
          title: Connections
        total_entries:
          type: integer
          title: Total Entries
      type: object
      required:
      - connections
      - total_entries
      title: ConnectionCollectionResponse
      description: Connection Collection serializer for responses.
    BulkActionOnExistence:
      type: string
      enum:
      - fail
      - skip
      - overwrite
      title: BulkActionOnExistence
      description: Bulk Action to be taken if the entity already exists or not.
  securitySchemes:
    OAuth2PasswordBearer:
      type: oauth2
      description: To authenticate Airflow API requests, clients must include a JWT (JSON Web Token) in the Authorization header of each request. This token is used to verify the identity of the client and ensure that they have the appropriate permissions to access the requested resources. You can use the endpoint ``POST /auth/token`` in order to generate a JWT token. Upon successful authentication, the server will issue a JWT token that contains the necessary information (such as user identity and scope) to authenticate subsequent requests. To learn more about Airflow public API authentication, please read https://airflow.apache.org/docs/apache-airflow/stable/security/api.html.
      flows:
        password:
          scopes: {}
          tokenUrl: /auth/token
    HTTPBearer:
      type: http
      scheme: bearer