130 lines
3.7 KiB
HTTP
130 lines
3.7 KiB
HTTP
@api_host = http://localhost:3001/api/v1/report-template
|
|
|
|
############### docx
|
|
### แสดงรายการในโฟลเดอร์ templates/docx
|
|
GET {{api_host}}/docx
|
|
|
|
### สร้างเอกสารจากรายการ template docx ปกติจะได้ docx แล้วจะใช้ libreoffice แปลงเป็นเอกสารอื่นๆโดยกำหนดที่ accept
|
|
# accept: application/msword , image/png, image/jpeg, application/pdf
|
|
# accept: application/vnd.oasis.opendocument.text,application/vnd.openxmlformats-officedocument.wordprocessingml.document
|
|
#POST {{api_host}}/docx?folder=test
|
|
POST {{api_host}}/docx
|
|
Content-Type: application/json
|
|
Accept: application/pdf
|
|
|
|
{
|
|
"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": "พลสิทธิ์"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
|
|
|
|
############### xlsx
|
|
### แสดงรายการในโฟลเดอร์ templates/xlsx
|
|
GET {{api_host}}/xlsx
|
|
|
|
### สร้างเอกสารจากรายการ template docx ปกติจะได้ docx แล้วจะใช้ libreoffice แปลงเป็นเอกสารอื่นๆโดยกำหนดที่ accept
|
|
# accept: application/msword , image/png, image/jpeg, application/pdf
|
|
# accept: application/vnd.oasis.opendocument.text,application/vnd.openxmlformats-officedocument.wordprocessingml.document
|
|
#POST {{api_host}}/docx?folder=test
|
|
POST {{api_host}}/xlsx
|
|
Content-Type: application/json
|
|
Accept: application/pdf
|
|
|
|
{
|
|
"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
|
|
}
|
|
]
|
|
}
|
|
}
|
|
### convert Grafana dashboard to pdf
|
|
POST {{api_host}}/html
|
|
Content-Type: application/json
|
|
Accept: application/pdf
|
|
|
|
{
|
|
"template": "https://bma-dashboard.frappet.synology.me/d/ANtkJay4z/4Lic4Li54LmJ4Lie4Li04LiB4Liy4Lij?orgId=1&kiosk",
|
|
"reportName": "html-grafana",
|
|
"htmlOption": {
|
|
"querySelector": ".scrollbar-view"
|
|
}
|
|
}
|
|
|
|
### convert blognone to png
|
|
POST {{api_host}}/html
|
|
Content-Type: application/json
|
|
Accept: image/png
|
|
|
|
{
|
|
"template": "https://www.blognone.com",
|
|
"reportName": "html-blognone"
|
|
}
|
|
|
|
### convert blognone to pdf
|
|
POST {{api_host}}/html
|
|
Content-Type: application/json
|
|
Accept: application/pdf
|
|
|
|
{
|
|
"template": "https://pantip.com",
|
|
"reportName": "html-pantip.com"
|
|
}
|