{ "openapi": "3.1.0", "info": { "title": "Report Server", "version": "0.8.0", "description": "Advance create and convert document API for microservice era.", "license": { "name": "by Frappet", "url": "https://frappet.com" } }, "servers": [ { "url": "https://report-server.frappet.synology.me" }, { "url": "https://bma-ehr.frappet.synology.me/" }, { "url": "http://localhost:3000" }, { "url": "http://192.168.2.100:3000" } ], "paths": { "/api/v1/report-template/convert": { "post": { "summary": "Create document from template", "tags": [ "office-convert" ], "parameters": [ { "name": "report_name", "in": "header", "description": "นามสกุลไฟล์ที่อัปโหลดเข้ามา(ตอนนี้ไม่จำเป็นต้องใช้เพราะ soffice ตรวจสอบเอง)", "required": true, "schema": { "type": "string", "example": "report" } } ], "requestBody": { "required": true, "content": { "application/octet-stream": { "schema": { "type": "string", "format": "binary" } } } }, "responses": { "201": { "description": "file was converted.", "content": { "application/pdf": { "schema": { "type": "string", "format": "binary" } }, "application/vnd.oasis.opendocument.text": { "schema": { "type": "string", "format": "binary" } }, "application/vnd.openxmlformats-officedocument.wordprocessingml.document": { "schema": { "type": "string", "format": "binary" } }, "application/msword": { "schema": { "type": "string", "format": "binary" } }, "text/html": { "schema": { "type": "string" } }, "image/png": { "schema": { "type": "string", "format": "binary" } }, "image/jpeg": { "schema": { "type": "string", "format": "binary" } } } }, "500": { "description": "Server error" } } } }, "/api/v1/report-template/docx": { "get": { "summary": "list docx template", "tags": [ "report-template" ], "responses": { "200": { "description": "array of template", "content": { "applicatin/json": { "schema": { "type": "array", "items": { "type": "string" } }, "example": [ "hello" ] } } }, "500": { "description": "Server error" } } }, "post": { "summary": "Create document from docx template output can be docx pdf odt", "tags": [ "report-template" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/templateData" }, "example": { "template": "hello", "reportName": "docx-report", "data": { "docNo": "๑๒๓๔๕", "me": "กระผม", "prefix": "นาย", "name": "สรวิชญ์", "surname": "พลสิทธิ์", "position": "Chief Technology Officer", "org": { "type": "บริษัท", "name": "เฟรปเป้ที", "url": "https://frappet.com" }, "employees": [ { "name": "ภาวิชญ์", "surname": "พลสิทธิ์" }, { "name": "วิชญาภา", "surname": "พลสิทธิ์" } ] } } } } }, "responses": { "201": { "description": "เอกสารถูกสร้างขึ้น", "content": { "application/vnd.openxmlformats-officedocument.wordprocessingml.document": { "schema": { "type": "string", "format": "binary" } }, "application/pdf": { "schema": { "type": "string", "format": "binary" } }, "application/vnd.oasis.opendocument.text": { "schema": { "type": "string", "format": "binary" } }, "image/png": { "schema": { "type": "string", "format": "binary" } }, "image/jpeg": { "schema": { "type": "string", "format": "binary" } } } }, "500": { "description": "Server error" } } } }, "/api/v1/report-template/xlsx": { "get": { "summary": "แสดงรายการ xlsx template", "tags": [ "report-template" ], "responses": { "200": { "description": "array of template", "content": { "applicatin/json": { "schema": { "type": "array", "items": { "type": "string" } }, "example": [ "hello" ] } } }, "500": { "description": "Server error" } } }, "post": { "summary": "สร้าองเอกสารจาก xlsx template แล้วส่งกลับมาเป็น xlsx pdf odt", "tags": [ "report-template" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/templateData" }, "example": { "template": "hello", "reportName": "xlsx-report", "data": { "docNo": "๑๒๓๔๕", "me": "กระผม", "prefix": "นาย", "name": "สรวิชญ์", "surname": "พลสิทธิ์", "position": "Chief Technology Officer", "org": { "type": "บริษัท", "name": "เฟรปเป้ที", "url": "https://frappet.com" }, "employees": [ { "id": 1, "name": "ภาวิชญ์", "surname": "พลสิทธิ์", "score": 80 }, { "id": 2, "name": "วิชญาภา", "surname": "พลสิทธิ์", "score": 50 }, { "id": 3, "name": "ฐิตาภา", "surname": "พลสิทธิ์", "score": 90 }, { "id": 4, "name": "สรวิชญ์ พลสิทธิ์", "surname": "พลสิทธิ์", "score": 99 } ] } } } } }, "responses": { "201": { "description": "เอกสารถูกสร้างขึ้น created.", "content": { "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": { "schema": { "type": "string", "format": "binary" } }, "application/pdf": { "schema": { "type": "string", "format": "binary" } }, "application/vnd.oasis.opendocument.spreadsheet": { "schema": { "type": "string", "format": "binary" } }, "image/png": { "schema": { "type": "string", "format": "binary" } }, "image/jpeg": { "schema": { "type": "string", "format": "binary" } } } }, "500": { "description": "Server error" } } } } }, "components": { "schemas": { "templateData": { "type": "object", "required": [ "template", "reportName", "data", "finished" ], "properties": { "template": { "type": "string", "description": "name of template" }, "reportName": { "type": "string", "description": "name of report for download" }, "data": { "type": "object", "description": "value for template" } } } } }, "tags": [ { "name": "office-convert", "description": "ใช้แปลงไฟล์จากเอกสารที่ libreoffice แปลงได้ x" }, { "name": "report-template", "description": "API สำหรับสร้างเอกสารจาก Template docx หรือ xlsx การทำงานคล้ายการทำ Mail Merge ทำให้ยูสเซอร์ทั่วไปแก้ Template ได้ง่าย สามารถแปลงไฟล์นามสกุลอื่นๆที่ soffice รองรับ" } ] }