288 lines
7.8 KiB
JSON
288 lines
7.8 KiB
JSON
{
|
|
"openapi": "3.0.0",
|
|
"info": {
|
|
"title": "REST4i - PDF Services",
|
|
"description": "PDF processing services for creating, manipulating, and extracting data from PDF documents on IBM i systems.",
|
|
"version": "1.0.7-rest4i",
|
|
"contact": {
|
|
"name": "API Support",
|
|
"url": "https://github.com/rest4i"
|
|
},
|
|
"license": {
|
|
"name": "Apache 2.0",
|
|
"url": "https://www.apache.org/licenses/LICENSE-2.0.html"
|
|
}
|
|
},
|
|
"servers": [
|
|
{
|
|
"url": "/rest4i/api"
|
|
}
|
|
],
|
|
"tags": [
|
|
{
|
|
"name": "PDF Services",
|
|
"description": "PDF processing services for creating, manipulating, and extracting data from PDF documents."
|
|
}
|
|
],
|
|
"paths": {
|
|
"/v1/pdf/convert": {
|
|
"post": {
|
|
"tags": ["PDF Services"],
|
|
"summary": "Convert HTML to PDF",
|
|
"description": "Convert HTML content to PDF document",
|
|
"operationId": "convertToPdf",
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ConvertRequest"
|
|
},
|
|
"example": {
|
|
"html": "<html><body><h1>Report</h1><p>Content here</p></body></html>",
|
|
"size": "A4",
|
|
"orientation": "portrait"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "PDF generated successfully",
|
|
"content": {
|
|
"application/pdf": {
|
|
"schema": {
|
|
"type": "string",
|
|
"format": "binary"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/v1/pdf/merge": {
|
|
"post": {
|
|
"tags": ["PDF Services"],
|
|
"summary": "Merge PDF files",
|
|
"description": "Merges multiple PDF files into a single PDF document.",
|
|
"operationId": "mergePdfs",
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/MergeRequest"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "PDFs merged successfully",
|
|
"content": {
|
|
"application/pdf": {
|
|
"schema": {
|
|
"type": "string",
|
|
"format": "binary"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad request - at least one PDF file is required",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Problem"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/v1/pdf/rotate": {
|
|
"post": {
|
|
"tags": ["PDF Services"],
|
|
"summary": "Rotate PDF pages",
|
|
"description": "Rotates all pages in a PDF document by the specified angle.",
|
|
"operationId": "rotatePdf",
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/RotateRequest"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "PDF rotated successfully",
|
|
"content": {
|
|
"application/pdf": {
|
|
"schema": {
|
|
"type": "string",
|
|
"format": "binary"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad request - PDF file is required",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Problem"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/v1/pdf/unprotect": {
|
|
"post": {
|
|
"tags": ["PDF Services"],
|
|
"summary": "Remove PDF protection",
|
|
"description": "Removes protection from a PDF document by converting it to images and back to PDF.",
|
|
"operationId": "unprotectPdf",
|
|
"requestBody": {
|
|
"required": true,
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/UnprotectRequest"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "PDF unprotected successfully",
|
|
"content": {
|
|
"application/pdf": {
|
|
"schema": {
|
|
"type": "string",
|
|
"format": "binary"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "Bad request - PDF file is required",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/Problem"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"components": {
|
|
"schemas": {
|
|
"ConvertRequest": {
|
|
"type": "object",
|
|
"properties": {
|
|
"html": {
|
|
"type": "string",
|
|
"description": "HTML content to convert to PDF"
|
|
},
|
|
"size": {
|
|
"type": "string",
|
|
"description": "Page size for the PDF",
|
|
"default": "A4",
|
|
"enum": ["A1", "A2", "A3", "A4", "A5", "A6", "A7"]
|
|
},
|
|
"orientation": {
|
|
"type": "string",
|
|
"description": "Page orientation",
|
|
"default": "portrait",
|
|
"enum": ["portrait", "landscape"]
|
|
}
|
|
},
|
|
"required": ["html"]
|
|
},
|
|
"MergeRequest": {
|
|
"type": "object",
|
|
"properties": {
|
|
"pdfFiles": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string",
|
|
"format": "byte"
|
|
},
|
|
"description": "Array of Base64 encoded PDF files to merge"
|
|
}
|
|
},
|
|
"required": ["pdfFiles"]
|
|
},
|
|
"RotateRequest": {
|
|
"type": "object",
|
|
"properties": {
|
|
"pdfFile": {
|
|
"type": "string",
|
|
"format": "byte",
|
|
"description": "Base64 encoded PDF file to rotate"
|
|
},
|
|
"rotation": {
|
|
"type": "integer",
|
|
"description": "Rotation angle (90, 180, 270, 360/0)",
|
|
"default": 90,
|
|
"enum": [90, 180, 270, 360, 0]
|
|
}
|
|
},
|
|
"required": ["pdfFile"]
|
|
},
|
|
"UnprotectRequest": {
|
|
"type": "object",
|
|
"properties": {
|
|
"pdfFile": {
|
|
"type": "string",
|
|
"format": "byte",
|
|
"description": "Base64 encoded protected PDF file"
|
|
}
|
|
},
|
|
"required": ["pdfFile"]
|
|
},
|
|
"Problem": {
|
|
"type": "object",
|
|
"properties": {
|
|
"error": {
|
|
"type": "string"
|
|
},
|
|
"message": {
|
|
"type": "string"
|
|
},
|
|
"code": {
|
|
"type": "integer",
|
|
"format": "int32"
|
|
},
|
|
"details": {
|
|
"type": "object"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"securitySchemes": {
|
|
"bearerHttpAuthentication": {
|
|
"type": "http",
|
|
"description": "Bearer token authentication.",
|
|
"scheme": "bearer",
|
|
"bearerFormat": "Bearer [token]"
|
|
},
|
|
"basicHttpAuthentication": {
|
|
"type": "http",
|
|
"description": "Basic authentication.",
|
|
"scheme": "basic"
|
|
}
|
|
}
|
|
}
|
|
}
|