{
  "openapi": "3.0.1",
  "info": {
    "title": "Ingest Service",
    "description": "Allow users to Ingest data for HCL Commerce.",
    "version": "9.1.20.0",
    "x-introduced": "9.1.0.0"
  },
  "servers": [
    {
      "url": "http://{hostname}:{port}",
      "description": "Toolkit server url",
      "variables": {
        "port": {
          "default": "443",
          "enum": [
            "443",
            "30800"
          ]
        },
        "hostname": {
          "default": "localhost",
          "enum": [
            "localhost",
            "test.hcl.com"
          ]
        }
      }
    }
  ],
  "paths": {
    "/connectors/{id}/run": {
      "post": {
        "tags": [
          "Index Data Operation"
        ],
        "summary": "Start a database connector manually.",
        "operationId": "triggerIngest",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "queryParams",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/CreateConnectorRun"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Request submitted successfully for processing.",
            "content": {}
          },
          "404": {
            "description": "The specified resource could not be found.",
            "content": {}
          },
          "500": {
            "description": "Internal server error during data ingest.",
            "content": {}
          }
        }
      }
    },
    "/connectors/{id}/data": {
      "post": {
        "tags": [
          "Index Data Operation"
        ],
        "summary": "Ingest data into specified connector.",
        "operationId": "ingestData",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Request submitted successfully for processing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Flowfile"
                }
              }
            }
          },
          "400": {
            "description": "Some of the inputs provided to the request are not valid.",
            "content": {}
          },
          "404": {
            "description": "The specified resource could not be found.",
            "content": {}
          },
          "500": {
            "description": "Internal server error during data ingest.",
            "content": {}
          }
        }
      }
    },
    "/connectors": {
      "get": {
        "tags": [
          "Connector Configuration"
        ],
        "summary": "Get descriptor of all connectors.",
        "description": "Retrieve all dataflow connector descriptors.",
        "operationId": "getConnectors",
        "responses": {
          "200": {
            "description": "Request completed successfully, returning a array containing a list of connector descriptors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseContainer"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error during connector retrieval.",
            "content": {}
          }
        }
      },
      "put": {
        "tags": [
          "Connector Configuration"
        ],
        "summary": "Update properties of all procesors under listed process-group for a connector.",
        "operationId": "updateConnectors",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateConnectorDescriptor"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Updated properties for sepcified pipes",
            "content": {}
          },
          "400": {
            "description": "Properties could not be updated as pipes do not exist. Bad request.",
            "content": {}
          },
          "409": {
            "description": "Properties could not be updated since another pipe/connector operation is currently in progress. Please try again later.",
            "content": {}
          },
          "500": {
            "description": "Internal server error during connector update.",
            "content": {}
          }
        }
      },
      "post": {
        "tags": [
          "Connector Configuration"
        ],
        "summary": "Create a new dataflow connector.",
        "operationId": "createConnector",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateConnectorDescriptor"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Request completed successfully, returning a connector descriptor that represents the newly created connector.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateConnectorDescriptor"
                }
              }
            }
          },
          "400": {
            "description": "Possible errors detected in the provided connector descriptor.",
            "content": {}
          },
          "409": {
            "description": "Connector could not be created since another connector is in the process of being created.",
            "content": {}
          },
          "500": {
            "description": "Internal server error during connector creation.",
            "content": {}
          }
        }
      }
    },
    "/connectors/{id}": {
      "get": {
        "tags": [
          "Connector Configuration"
        ],
        "summary": "Get descriptor of specified connector.",
        "description": "Retrieve descriptor of specified dataflow connector.",
        "operationId": "getConnectorById",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Request completed successfully, returning the connector descriptor.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectorDescriptor"
                }
              }
            }
          },
          "404": {
            "description": "Given dataflow connector does not exist.",
            "content": {}
          },
          "500": {
            "description": "Internal server error during connector retrieval.",
            "content": {}
          }
        }
      },
      "delete": {
        "tags": [
          "Connector Configuration"
        ],
        "summary": "Delete select connector.",
        "description": "Delete the specified connector.",
        "operationId": "deleteConnector",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Connector deleted successfully.",
            "content": {}
          },
          "400": {
            "description": "Connector could not be deleted since it does not exist. Bad request.",
            "content": {}
          },
          "409": {
            "description": "Connector could not be deleted since another connector operation is currently in progress. Please try again later.",
            "content": {}
          },
          "500": {
            "description": "Internal server error during connector deletion.",
            "content": {}
          }
        }
      }
    },
    "/connectors/{connectorId}/runs": {
      "get": {
        "tags": [
          "Get Messages"
        ],
        "summary": "Get all runs for a given connector.",
        "operationId": "getConnectorRuns",
        "parameters": [
          {
            "name": "connectorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1000
            }
          },
          {
            "name": "orderDate",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "asc"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Retrieved all logs for specified run",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "The specified connector does not exist.",
            "content": {}
          },
          "500": {
            "description": "Internal server while retrieving logs for run.",
            "content": {}
          }
        }
      }
    },
    "/connectors/{connectorId}/runs/{runId}": {
      "get": {
        "tags": [
          "Get Messages"
        ],
        "summary": "Get all runs for a given connector.",
        "operationId": "getLogs",
        "parameters": [
          {
            "name": "connectorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1000
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "default": "summary,trace,log"
            }
          },
          {
            "name": "logSeverity",
            "in": "query",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "default": "I,E,T"
            }
          },
          {
            "name": "orderDate",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "asc"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Retrieved all logs for specified run",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "The specified connector does not exist.",
            "content": {}
          },
          "500": {
            "description": "Internal server while retrieving logs for run.",
            "content": {}
          }
        }
      }
    },
    "/connectors/{connectorId}/runs/{runId}/status": {
      "get": {
        "tags": [
          "Get Messages"
        ],
        "summary": "Get status for specific run for a given connector.",
        "operationId": "getStatusLogs",
        "parameters": [
          {
            "name": "connectorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "runId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Aggregated all logs for specified run into one status log",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RunIdStatus"
                }
              }
            }
          },
          "400": {
            "description": "The specified connector does not exist.",
            "content": {}
          },
          "500": {
            "description": "Internal server while retrieving logs for run.",
            "content": {}
          }
        }
      }
    },
    "/connectors/{id}/upgrade": {
      "post": {
        "tags": [
          "Connector Configuration"
        ],
        "summary": "Upgrade select connector.",
        "description": "Upgrade the specified connector to use the newest version of its pipes.",
        "operationId": "upgradeConnector",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateConnectorDescriptor"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Connector updated successfully.",
            "content": {}
          },
          "400": {
            "description": "Connector could not be upgraded since it does not exist. Bad request.",
            "content": {}
          },
          "409": {
            "description": "Connector could not be upgraded since another connector operation is currently in progress. Please try again later.",
            "content": {}
          },
          "500": {
            "description": "Internal server error during connector upgrade.",
            "content": {}
          }
        }
      }
    },
    "/connectors/{id}/cancel": {
      "post": {
        "tags": [
          "Index Data Operation"
        ],
        "summary": "Cancel ingest of flow files in select connector.",
        "description": "Cancel all flow files currently being ingested in a connector.",
        "operationId": "cancelConnectorIngest",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Connector ingest cancelled successfully.",
            "content": {}
          },
          "400": {
            "description": "Connector ingest could not be cancelled since connector does not exist. Bad request.",
            "content": {}
          },
          "409": {
            "description": "Connector ingest could not be cancelled since another connector operation is currently in progress. Please try again later.",
            "content": {}
          },
          "500": {
            "description": "Internal server error during connector cancel.",
            "content": {}
          }
        }
      }
    },
    "/connectors/{connectorName}/pipes/{pipeName}": {
      "put": {
        "tags": [
          "Connector Upgrade"
        ],
        "x-introduced": "9.1.15.1",
        "summary": "Update bucketSize,pageSize,concurrentThreads of all procesors under listed process-group for a connector.",
        "operationId": "updateDescriptor",
        "parameters": [
          {
            "name": "connectorName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "pipeName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "bucketSize",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "extractThreadCount",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "transformThreadCount",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "cacheTTL",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Updated properties for sepcified pipes",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Properties could not be updated as pipes do not exist. Bad request.",
            "content": {}
          },
          "409": {
            "description": "Properties could not be updated since another pipe/connector operation is currently in progress. Please try again later.",
            "content": {}
          },
          "500": {
            "description": "Internal server error during connector update.",
            "content": {}
          }
        }
      }
    },
    "/connectors/{id}/enable": {
      "post": {
        "tags": [
          "Connector Operation"
        ],
        "summary": "Enable/start the select connector.",
        "description": "Enable or start all pipes contained in the connector.",
        "operationId": "enableConnector",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Connector enabled successfully.",
            "content": {}
          },
          "400": {
            "description": "Connector could not be enabled since connector does not exist. Bad request.",
            "content": {}
          },
          "409": {
            "description": "Connector could not be enabled since another connector operation is currently in progress. Please try again later.",
            "content": {}
          },
          "500": {
            "description": "Internal server error during connector start.",
            "content": {}
          }
        }
      }
    },
    "/connectors/{id}/disable": {
      "post": {
        "tags": [
          "Connector Operation"
        ],
        "summary": "Disable/stop the select connector.",
        "description": "Disable or stop all pipes contained in the connector.",
        "operationId": "disableConnector",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Connector disabled successfully.",
            "content": {}
          },
          "400": {
            "description": "Connector could not be disabled since connector does not exist. Bad request.",
            "content": {}
          },
          "409": {
            "description": "Connector could not be disabled since another connector operation is currently in progress. Please try again later.",
            "content": {}
          },
          "500": {
            "description": "Internal server error during connector stop.",
            "content": {}
          }
        }
      }
    },
    "/health": {
      "get": {
        "tags": [
          "Health"
        ],
        "summary": "Get liveness.",
        "description": "Get liveness of the Ingest service.",
        "operationId": "getHealth",
        "responses": {
          "200": {
            "description": "Ingest service is in a healthy live state.",
            "content": {}
          }
        }
      }
    },
    "/health/readiness": {
      "get": {
        "tags": [
          "Health"
        ],
        "summary": "Get readiness.",
        "description": "Get readiness of the Ingest service.",
        "operationId": "getHealthReadiness",
        "responses": {
          "200": {
            "description": "Ingest service is not in busy state.",
            "content": {}
          },
          "503": {
            "description": "Ingest service is in busy state.",
            "content": {}
          }
        }
      }
    },
    "/status": {
      "get": {
        "tags": [
          "Nifi Status"
        ],
        "summary": "Get Status of the Nifi service on the basis of supplied input parameter/(S).",
        "description": "To check the status of Nifi status acceptable parameters threads,queues,versions,components",
        "operationId": "getNifiHealthReadiness",
        "responses": {
          "200": {
            "description": "Request completed successfully, returning current parameters NiFi Service.",
            "content": {}
          },
          "503": {
            "description": "Nifi Service is not available.",
            "content": {}
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "RunIdStatus": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string"
          },
          "runId": {
            "type": "string"
          },
          "fromType": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          }
        }
      },
      "CreateConnectorRun": {
        "type": "object",
        "properties": {
          "storeId": {
            "type": "string"
          },
          "envType": {
            "type": "string"
          }
        }
      },
      "Flowfile": {
        "type": "object",
        "properties": {
          "runId": {
            "type": "string"
          }
        }
      },
      "Component": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "sourceName": {
            "type": "string"
          },
          "destinationName": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "CONTROLLER_SERVICE",
              "PROCESS_GROUP",
              "PROCESSOR",
              "CONNECTION"
            ]
          }
        }
      },
      "CreateConnectorDescriptor": {
        "required": [
          "description",
          "name",
          "pipes"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "A unique identifier for the connector."
          },
          "name": {
            "type": "string",
            "description": "A language specific name for this dataflow connector."
          },
          "description": {
            "type": "string",
            "description": "A language specific short description for this dataflow connector."
          },
          "environment": {
            "type": "array",
            "description": "A list of environment for the connector to auto load.",
            "items": {
              "type": "string",
              "description": "A list of environment for the connector to auto load."
            }
          },
          "created": {
            "type": "string",
            "description": "When the connector was created."
          },
          "modified": {
            "type": "string",
            "description": "When the connector was last modified."
          },
          "schedule": {
            "$ref": "#/components/schemas/Schedule"
          },
          "pipes": {
            "type": "array",
            "description": "A list of the names of process groups (pipes) that currently exist in Registry, in the order they should be connected in NiFi to create a connector. ",
            "items": {
              "$ref": "#/components/schemas/Pipe"
            }
          },
          "schemas": {
            "type": "array",
            "description": "A list of elastic search indices to be created mapped to their respective schemas.",
            "items": {
              "$ref": "#/components/schemas/NamedSchema"
            }
          }
        }
      },
      "NamedSchema": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "schema": {
            "type": "object"
          }
        },
        "description": "A list of elastic search indices to be created mapped to their respective schemas."
      },
      "Pipe": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "version": {
            "type": "integer",
            "format": "int32"
          },
          "properties": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Property"
            }
          }
        },
        "description": "A list of the names of process groups (pipes) that currently exist in Registry, in the order they should be connected in NiFi to create a connector. "
      },
      "Property": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "value": {
            "type": "string"
          },
          "scope": {
            "$ref": "#/components/schemas/Component"
          }
        }
      },
      "Schedule": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "startDate": {
            "type": "string"
          },
          "endDate": {
            "type": "string"
          },
          "startTime": {
            "type": "string"
          },
          "everyInterval": {
            "type": "string"
          }
        },
        "description": "A section defining one recurring schedule for this connector. It includes mandatory fields of enabled and start_time, followed by optional fields of start_date, end_date, and every. See Usage section for details."
      },
      "ConnectorDescriptor": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "A unique identifier for the connector."
          },
          "name": {
            "type": "string",
            "description": "A language specific name for this dataflow connector."
          },
          "description": {
            "type": "string",
            "description": "A language specific short description for this dataflow connector."
          },
          "environment": {
            "type": "array",
            "description": "A list of environment for the connector to auto load.",
            "items": {
              "type": "string",
              "description": "A list of environment for the connector to auto load."
            }
          },
          "created": {
            "type": "string",
            "description": "When the connector was created."
          },
          "modified": {
            "type": "string",
            "description": "When the connector was last modified."
          },
          "schedule": {
            "$ref": "#/components/schemas/Schedule"
          },
          "pipes": {
            "type": "array",
            "description": "A list of the names of process groups (pipes) that currently exist in Registry, in the order they should be connected in NiFi to create a connector. ",
            "items": {
              "$ref": "#/components/schemas/Pipe"
            }
          },
          "schemas": {
            "type": "array",
            "description": "A list of elastic search indices to be created mapped to their respective schemas.",
            "items": {
              "$ref": "#/components/schemas/NamedSchema"
            }
          }
        }
      },
      "ResponseContainer": {
        "type": "object",
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ConnectorDescriptor"
            }
          },
          "offset": {
            "type": "integer",
            "format": "int32"
          },
          "size": {
            "type": "integer",
            "format": "int32"
          }
        }
      },
      "UpdateConnectorDescriptor": {
        "required": [
          "name",
          "pipes"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "A unique identifier for the connector."
          },
          "name": {
            "type": "string",
            "description": "A language specific name for this dataflow connector."
          },
          "description": {
            "type": "string",
            "description": "A language specific short description for this dataflow connector."
          },
          "environment": {
            "type": "array",
            "description": "A list of environment for the connector to auto load.",
            "items": {
              "type": "string",
              "description": "A list of environment for the connector to auto load."
            }
          },
          "created": {
            "type": "string",
            "description": "When the connector was created."
          },
          "modified": {
            "type": "string",
            "description": "When the connector was last modified."
          },
          "schedule": {
            "$ref": "#/components/schemas/Schedule"
          },
          "pipes": {
            "type": "array",
            "description": "A list of the names of process groups (pipes) that currently exist in Registry, in the order they should be connected in NiFi to create a connector. ",
            "items": {
              "$ref": "#/components/schemas/Pipe"
            }
          },
          "schemas": {
            "type": "array",
            "description": "A list of elastic search indices to be created mapped to their respective schemas.",
            "items": {
              "$ref": "#/components/schemas/NamedSchema"
            }
          }
        }
      }
    }
  }
}
