{
  "openapi": "3.0.4",
  "info": {
    "title": "Transactions API",
    "version": "2.0.0"
  },
  "servers": [
    {
      "url": "https://api.staging.de.insiders.cloud"
    }
  ],
  "paths": {
    "/1/rest/subsystems/transactions": {
      "post": {
        "tags": [
          "Transaction"
        ],
        "operationId": "BeginTransaction",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/BeginTransactionRequest"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BeginTransactionResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/BeginTransactionResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/1/rest/subsystems/transactions/{transactionId}/commit": {
      "delete": {
        "tags": [
          "Transaction"
        ],
        "operationId": "Commit",
        "parameters": [
          {
            "name": "transactionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/1/rest/subsystems/transactions/{transactionId}/{tablename}": {
      "put": {
        "tags": [
          "Transaction"
        ],
        "operationId": "WriteData",
        "parameters": [
          {
            "name": "transactionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tablename",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "Array of row data to write",
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "type": "array",
                  "items": {
                    "type": "object"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteDataResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteDataResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteDataResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteDataResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteDataResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/WriteDataResponse"
                }
              }
            }
          }
        }
      }
    },
    "/1/rest/subsystems/transactions/{transactionId}/rollback": {
      "delete": {
        "tags": [
          "Transaction"
        ],
        "operationId": "Rollback",
        "parameters": [
          {
            "name": "transactionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/1/rest/subsystems/transactions/{transactionId}/status": {
      "get": {
        "tags": [
          "Transaction"
        ],
        "operationId": "Status",
        "parameters": [
          {
            "name": "transactionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetTransactionStatusResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/GetTransactionStatusResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/1/rest/subsystems/transactions/{transactionId}/{tablename}/deletedata": {
      "post": {
        "tags": [
          "Transaction"
        ],
        "operationId": "DeleteData",
        "parameters": [
          {
            "name": "transactionId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tablename",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "Array of primary key values to delete",
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "type": "array",
                  "items": {
                    "type": "object"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteDataResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteDataResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteDataResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteDataResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteDataResponse"
                }
              },
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteDataResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AsyncTransactionInfo": {
        "type": "object",
        "properties": {
          "Id": {
            "type": "string"
          },
          "Messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AsyncTransactionMessage"
            }
          }
        },
        "additionalProperties": false
      },
      "AsyncTransactionMessage": {
        "type": "object",
        "properties": {
          "Timestamp": {
            "type": "string",
            "format": "date-time"
          },
          "Message": {
            "type": "string"
          },
          "Type": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "BeginTransactionRequest": {
        "required": [
          "subsystem",
          "tableMetaData"
        ],
        "type": "object",
        "properties": {
          "subsystem": {
            "minLength": 1,
            "type": "string"
          },
          "tableMetaData": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TableMetaData"
            }
          },
          "commitStrategy": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CommitStrategy"
              }
            ],
            "default": "BestEffort",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "BeginTransactionResponse": {
        "required": [
          "transactionId"
        ],
        "type": "object",
        "properties": {
          "transactionId": {
            "minLength": 1,
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "CommitStrategy": {
        "enum": [
          "BestEffort",
          "RollbackOnPrimaryKeyErrors"
        ],
        "type": "string"
      },
      "DeleteDataResponse": {
        "type": "object",
        "properties": {
          "errors": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MasterDataError"
            }
          }
        },
        "additionalProperties": false
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "correlationId": {
            "type": "string",
            "nullable": true
          },
          "errorCode": {
            "type": "integer",
            "format": "int32"
          },
          "message": {
            "type": "string"
          },
          "details": {
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "GetTransactionStatusResponse": {
        "required": [
          "ImportJob",
          "TransactionState"
        ],
        "type": "object",
        "properties": {
          "TransactionState": {
            "allOf": [
              {
                "$ref": "#/components/schemas/TransactionProcessState"
              }
            ]
          },
          "ImportJob": {
            "allOf": [
              {
                "$ref": "#/components/schemas/AsyncTransactionInfo"
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "MasterDataError": {
        "type": "object",
        "properties": {
          "index": {
            "type": "integer",
            "format": "int32"
          },
          "error": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "TableMetaData": {
        "required": [
          "clear",
          "columns",
          "tableName"
        ],
        "type": "object",
        "properties": {
          "columns": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "tableName": {
            "minLength": 1,
            "type": "string"
          },
          "clear": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "TransactionProcessState": {
        "enum": [
          "ReceivingData",
          "WaitingForImport",
          "Importing",
          "Finished",
          "RolledBack",
          "Failed",
          "Unknown"
        ],
        "type": "string"
      },
      "WriteDataResponse": {
        "type": "object",
        "properties": {
          "errors": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MasterDataError"
            }
          }
        },
        "additionalProperties": false
      }
    },
    "securitySchemes": {
      "token": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    }
  },
  "security": [
    {
      "token": [ ]
    }
  ],
  "tags": [
    {
      "name": "Transaction"
    }
  ]
}