{
  "openapi": "3.0.4",
  "info": {
    "title": "DocumentRendering API",
    "description": "**Welcome to the DocumentRendering API documentation.**\r\n\r\nYou can test the API using **[Swagger](/document-rendering/demo/v10-0/docs/swagger)**.\r\n\r\nYou can find a detailed documentation by following **[this link](https://docs.egov4.ch/docs/9.0/category/document-rendering-api)**.\r\n",
    "contact": {
      "name": "Artionet",
      "url": "https://www.artionet.ch/",
      "email": "support@artionet.com"
    },
    "version": "v10.0",
    "x-logo": {
      "url": "/document-rendering/demo/v10-0/Documentation/Images/logo_artionet.png",
      "backgroundColor": "#fafafa",
      "altText": "Artionet Logo"
    }
  },
  "servers": [
    {
      "url": "/document-rendering/demo/v10-0"
    }
  ],
  "paths": {
    "/renderer/documents": {
      "post": {
        "tags": [
          "Renderer"
        ],
        "summary": "Render a document",
        "description": "Allows to render a document based on either a provided template or a saved template using provided data.",
        "operationId": "RenderDocument",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/DocumentRenderingForCreationDto"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/octet-stream": { }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/templates/{templateName}": {
      "get": {
        "tags": [
          "Templates"
        ],
        "summary": "Get a template",
        "description": "Allows to get a template based on its name.",
        "operationId": "GetTemplateByName",
        "parameters": [
          {
            "name": "templateName",
            "in": "path",
            "required": true,
            "schema": {
              "maxLength": 50,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TemplateWithDataDto"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Templates"
        ],
        "summary": "Save a template",
        "description": "Allows to save/overwrite a template to use it with the rendering endpoint.",
        "operationId": "CreateTemplate",
        "parameters": [
          {
            "name": "templateName",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json-patch+json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/TemplateForCreationDto"
                  }
                ]
              }
            },
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/TemplateForCreationDto"
                  }
                ]
              }
            },
            "text/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/TemplateForCreationDto"
                  }
                ]
              }
            },
            "application/*+json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/TemplateForCreationDto"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created"
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Templates"
        ],
        "summary": "Delete a template",
        "description": "Allows to delete a template.",
        "operationId": "DeleteTemplate",
        "parameters": [
          {
            "name": "templateName",
            "in": "path",
            "required": true,
            "schema": {
              "maxLength": 50,
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No Content"
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/templates": {
      "get": {
        "tags": [
          "Templates"
        ],
        "summary": "Get a list of available templates",
        "description": "Allows to get a list of existing templates.",
        "operationId": "GetTemplates",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/TemplateDto"
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "DocumentRenderingForCreationDto": {
        "required": [
          "inputFormat",
          "outputFormat"
        ],
        "type": "object",
        "properties": {
          "inputFormat": {
            "maxLength": 10,
            "minLength": 1,
            "type": "string"
          },
          "outputFormat": {
            "maxLength": 10,
            "minLength": 1,
            "type": "string"
          },
          "data": {
            "type": "string",
            "nullable": true
          },
          "rendererOptions": {
            "type": "string",
            "nullable": true
          },
          "templateData": {
            "type": "string",
            "nullable": true
          },
          "templateName": {
            "maxLength": 50,
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "HttpValidationProblemDetails": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ProblemDetails"
          },
          {
            "type": "object",
            "properties": {
              "errors": {
                "type": "object",
                "additionalProperties": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                }
              }
            },
            "additionalProperties": { }
          }
        ]
      },
      "ProblemDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "detail": {
            "type": "string",
            "nullable": true
          },
          "instance": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": { }
      },
      "TemplateDto": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "TemplateForCreationDto": {
        "required": [
          "data"
        ],
        "type": "object",
        "properties": {
          "data": {
            "minLength": 1,
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "TemplateWithDataDto": {
        "allOf": [
          {
            "$ref": "#/components/schemas/TemplateDto"
          },
          {
            "type": "object",
            "properties": {
              "data": {
                "type": "string"
              }
            },
            "additionalProperties": false
          }
        ]
      }
    }
  },
  "tags": [
    {
      "name": "Renderer"
    },
    {
      "name": "Templates"
    }
  ]
}