{ "openapi": "3.1.0", "info": { "title": "Report Server", "version": "0.8.1", "description": "Technical preview releases - Report Server
Advance create and convert document API for microservice era. ", "license": { "name": "by oom@Frappet", "url": "https://frappet.com" } }, "servers": [ { "url": "https://report-server.frappet.synology.me" }, { "url": "https://bma-ehr.frappet.synology.me/" }, { "url": "http://localhost:3001" } ], "paths": { "/api/v1/report-template/convert": { "post": { "summary": "แปลงฟอร์แม็ตเอกสารเช่นจาก docx เป็น pdf ให้ตั้งค่า Media type เป็นชนิดไฟล์ที่ต้องการ", "tags": [ "office-convert" ], "parameters": [ { "name": "report-name", "in": "header", "description": "ชื่อไฟล์ที่ต้องการหลังแปลง", "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" } }, "image/png": { "schema": { "type": "string", "format": "binary" } }, "image/jpeg": { "schema": { "type": "string", "format": "binary" } } } }, "400": { "description": "Invalid format" }, "500": { "description": "Server error" } } } }, "/api/v1/report-template/docx": { "get": { "summary": "แสดงรายการ template ที่มีในโฟลเดอร์ templates", "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": "สร้างเอกสารโดยใช้ template จากไฟล์ docx จะแทนค่าตัวแปรในเอกสาร หรือจะแปลงเป็นฟอร์แม็ตอื่นได้ด้วยรองรับ docx pdf odt, ค่า template เป็นชื่อของ template, reportName เป็นชื่อไฟล์ที่ต้องการ", "tags": [ "report-template" ], "parameters": [ { "name": "folder", "in": "query", "description": "ชื่อโฟลเดอร์", "required": false, "schema": { "type": "string", "example": "test" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/templateOption" }, "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/docx/upload": { "post": { "summary": "อัพไฟล์ docx", "tags": [ "report-template" ], "parameters": [ { "name": "report_name", "in": "query", "description": "ชื่อไฟล์", "required": true, "schema": { "type": "string", "example": "report" } }, { "name": "folder", "in": "query", "description": "ชื่อโฟลเดอร์", "required": false, "schema": { "type": "string", "example": "test" } } ], "requestBody": { "required": true, "content": { "application/octet-stream": { "schema": { "type": "string", "format": "binary" } } } }, "responses": { "201": { "description": "file was converted.", "content": { "application/vnd.openxmlformats-officedocument.wordprocessingml.document": { "schema": { "type": "string", "format": "binary" } }, "application/msword": { "schema": { "type": "string", "format": "binary" } }, "application/pdf": { "schema": { "type": "string", "format": "binary" } }, "image/png": { "schema": { "type": "string", "format": "binary" } }, "image/jpeg": { "schema": { "type": "string", "format": "binary" } } } }, "400": { "description": "Invalid format" }, "500": { "description": "Server error" } } } }, "/api/v1/report-template/docx/download": { "post": { "summary": "โหลดไฟล์ docx", "tags": [ "report-template" ], "parameters": [ { "name": "folder", "in": "query", "description": "ชื่อโฟลเดอร์", "required": false, "schema": { "type": "string", "example": "test" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/templateOption" }, "example": { "template": "docx-report" } } } }, "responses": { "201": { "description": "เอกสารถูกสร้างขึ้น", "content": { "application/vnd.openxmlformats-officedocument.wordprocessingml.document": { "schema": { "type": "string", "format": "binary" } }, "application/vnd.oasis.opendocument.text": { "schema": { "type": "string", "format": "binary" } } } }, "500": { "description": "Server error" } } } }, "/api/v1/report-template/html": { "post": { "summary": "แปลหน้าเวปไปเป็น pdf , png, jpeg (ฟีเจอร์ html template ด้วย handlebars ยังไม่เสร็จ) ค่า template เป็น url ของหน้าเวปที่ต้องการ, reportName เป็นชื่อไฟล์ที่ต้องการ", "tags": [ "report-template" ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/templateOption" }, "example": { "template": "https://bma-dashboard.frappet.synology.me/d/ANtkJay4z/4Lic4Li54LmJ4Lie4Li04LiB4Liy4Lij?orgId=1&kiosk", "reportName": "html-report", "htmlOption": { "querySelector": ".scrollbar-view" } } } } }, "responses": { "201": { "description": "เอกสารถูกสร้างขึ้น", "content": { "application/pdf": { "schema": { "type": "string", "format": "binary" } }, "image/png": { "schema": { "type": "string", "format": "binary" } }, "image/jpeg": { "schema": { "type": "string", "format": "binary" } } } }, "400": { "description": "format error" }, "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 , ค่า template เป็นชื่อของ template ที่ใช้งาน, reportName เป็นชื่อไฟล์ที่ต้องการ", "tags": [ "report-template" ], "parameters": [ { "name": "folder", "in": "query", "description": "ชื่อโฟลเดอร์", "required": false, "schema": { "type": "string", "example": "test" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/templateOption" }, "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.ms-excel": { "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" } } } }, "/api/v1/report-template/xlsx/upload": { "post": { "summary": "อัพไฟล์ xlsx", "tags": [ "report-template" ], "parameters": [ { "name": "report_name", "in": "query", "description": "ชื่อไฟล์", "required": true, "schema": { "type": "string", "example": "report" } }, { "name": "folder", "in": "query", "description": "ชื่อโฟลเดอร์", "required": false, "schema": { "type": "string", "example": "test" } } ], "requestBody": { "required": true, "content": { "application/octet-stream": { "schema": { "type": "string", "format": "binary" } } } }, "responses": { "201": { "description": "file was converted.", "content": { "application/octet-stream": { "schema": { "type": "string", "format": "binary" } } } }, "400": { "description": "Invalid format" }, "500": { "description": "Server error" } } } }, "/api/v1/report-template/xlsx/download": { "post": { "summary": "โหลดไฟล์ xlsx", "tags": [ "report-template" ], "parameters": [ { "name": "folder", "in": "query", "description": "ชื่อโฟลเดอร์", "required": false, "schema": { "type": "string", "example": "test" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/templateOption" }, "example": { "template": "xlsx-report" } } } }, "responses": { "201": { "description": "เอกสารถูกสร้างขึ้น", "content": { "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": { "schema": { "type": "string", "format": "binary" } } } }, "500": { "description": "Server error" } } } } }, "components": { "schemas": { "templateOption": { "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 แปลงได้ เช่น docx เป็น pdf" }, { "name": "report-template", "description": "API สำหรับสร้างเอกสารจาก Template docx หรือ xlsx การทำงานคล้ายการทำ Mail Merge ทำให้ยูสเซอร์ทั่วไปแก้ Template ได้ง่าย สามารถแปลงไฟล์นามสกุลอื่นๆที่ soffice รองรับ" } ] }