템플릿 HTML 미리보기
모든 Smart Report 템플릿 정의를 메모리 내에서 독립형 HTML 문서로 완전히 렌더링합니다. 데이터베이스 레코드를 생성하거나 수정하지 않으며 미리보기 렌더링 중 Chromium을 실행하지도 않으므로, 대화형 템플릿 편집기, CI 검증 확인 및 AI 설계 루프에서 빠른 응답 시간을 유지할 수 있습니다.
헤드리스 및 AI 파이프라인에서는 리포트 템플릿 생성 또는 리포트 템플릿 수정으로 템플릿을 저장하기 전에 sections, reportTheme, 여백 및 검증 점수 설정(score, scoreProfile, scoreScale)을 반복 테스트할 때 이 엔드포인트를 사용하세요. sampleData 내부에 steps 또는 results를 제공하지 않고 테마 또는 점수가 적용된 템플릿을 렌더링하면, 렌더러가 미리보기가 완전하게 유지되도록 합성 드라이버 샘플 데이터를 자동으로 주입합니다.
엔드포인트
POST https://api.verifik.co/v2/smart-report-templates/preview-html
Smart-Agent 프록시(https://ai.verifik.co)도 동일한 /v2/... 경로를 제공하며 본인의 Authorization: Bearer <VERIFIK_JWT> 헤더가 필요합니다.
헤더
| 이름 | 값 |
|---|---|
| Content-Type | application/json |
| Accept | application/json |
| Authorization | Bearer <VERIFIK_JWT> |
요청 본문
이 엔드포인트는 미리보기/점수 도우미와 모든 공개 템플릿 디자인 필드(sections, reportTheme, sampleData, margins, pageSize, orientation, pdfEngine, primaryColor, identityColor, pageBackgroundColor, logo, header, footer, legend, termsAndConditions, watermark, showPageNumbers, customFonts 등)를 허용합니다.
| 이름 | 타입 | 필수 | 설명 |
|---|---|---|---|
name | string | 아니요 | 미리보기 머리글/메타데이터에 표시할 선택적 리포트 제목. |
preview | boolean | 아니요 | 미리보기 모드 전환. 기본값은 true입니다. |
score | boolean | 아니요 | 검증 점수 계산을 활성화하고 응답에 verificationScore를 포함합니다. |
scoreProfile | string | 아니요 | 점수 프로필 목록 조회의 점수 프로필 ID. 최대 64자. |
scoreScale | string | 아니요 | 점수 표시 척도: "unit" 또는 "percent". 최상위 미리보기 도우미이며, 저장할 때는 reportTheme.scoreScale 아래에 저장하세요. |
themeTokens | object | 아니요 | 사용자 지정 테마 토큰 재정의. 최상위 미리보기 도우미이며, 저장할 때는 reportTheme.tokens 아래에 저장하세요. |
scoreSettings | object | 아니요 | 점수 표시 설정. 최상위 미리보기 도우미이며, 저장할 때는 reportTheme(scoreEnabled, scoreProfile) 아래에 저장하세요. |
sections | object[] | 아니요 | 렌더링할 ReportSection 블록 배열. |
reportTheme | string / object | 아니요 | 테마 프리셋 ID("premium_dark", "light_cards", "editorial", "dashboard") 또는 전체 reportTheme 구성 객체. |
sampleData | object | 아니요 | 검증 샘플 페이로드(inputData, results, batchName, rowIndex). 테마/점수가 적용된 미리보기에서 생략되면 합성 드라이버 샘플이 주입됩니다. |
pageSize | string | 아니요 | "A4", "Letter" 또는 "Legal". 기본값은 "A4"입니다. |
orientation | string | 아니요 | "portrait" 또는 "landscape". 기본값은 "portrait"입니다. |
margins | object | 아니요 | 여백 객체 `{ "top": 40, "right": 40, "bottom": 40, "left": 40 }`. |
요청
- Node.js
- PHP
- Python
- Go
- cURL
const fetch = require("node-fetch");
async function run() {
const res = await fetch(
"https://api.verifik.co/v2/smart-report-templates/preview-html",
{
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
Authorization: `Bearer ${process.env.VERIFIK_JWT}`,
},
body: JSON.stringify({
name: "Driver Background Preview",
preview: true,
score: true,
scoreProfile: "cabify_driver",
scoreScale: "percent",
pageSize: "A4",
orientation: "portrait",
margins: { top: 40, right: 40, bottom: 40, left: 40 },
reportTheme: "light_cards",
sections: [
{
id: "sec-score",
type: "scoreGauge",
order: 0,
label: "Overall Score",
},
{
id: "sec-breakdown",
type: "categoryBreakdown",
order: 1,
label: "Category Breakdown",
},
],
}),
}
);
console.log(await res.json());
}
run();
<?php
$payload = [
"name" => "Driver Background Preview",
"preview" => true,
"score" => true,
"scoreProfile" => "cabify_driver",
"scoreScale" => "percent",
"pageSize" => "A4",
"orientation" => "portrait",
"margins" => ["top" => 40, "right" => 40, "bottom" => 40, "left" => 40],
"reportTheme" => "light_cards",
"sections" => [
["id" => "sec-score", "type" => "scoreGauge", "order" => 0, "label" => "Overall Score"],
["id" => "sec-breakdown", "type" => "categoryBreakdown", "order" => 1, "label" => "Category Breakdown"],
],
];
$ch = curl_init("https://api.verifik.co/v2/smart-report-templates/preview-html");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Content-Type: application/json",
"Accept: application/json",
"Authorization: Bearer " . getenv("VERIFIK_JWT"),
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo curl_exec($ch);
curl_close($ch);
import os
import requests
url = "https://api.verifik.co/v2/smart-report-templates/preview-html"
headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": f"Bearer {os.getenv('VERIFIK_JWT')}",
}
payload = {
"name": "Driver Background Preview",
"preview": True,
"score": True,
"scoreProfile": "cabify_driver",
"scoreScale": "percent",
"pageSize": "A4",
"orientation": "portrait",
"margins": {"top": 40, "right": 40, "bottom": 40, "left": 40},
"reportTheme": "light_cards",
"sections": [
{"id": "sec-score", "type": "scoreGauge", "order": 0, "label": "Overall Score"},
{"id": "sec-breakdown", "type": "categoryBreakdown", "order": 1, "label": "Category Breakdown"},
],
}
r = requests.post(url, json=payload, headers=headers)
print(r.json())
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"os"
)
func main() {
body, _ := json.Marshal(map[string]interface{}{
"name": "Driver Background Preview",
"preview": true,
"score": true,
"scoreProfile": "cabify_driver",
"scoreScale": "percent",
"pageSize": "A4",
"orientation": "portrait",
"margins": map[string]int{"top": 40, "right": 40, "bottom": 40, "left": 40},
"reportTheme": "light_cards",
"sections": []map[string]interface{}{
{"id": "sec-score", "type": "scoreGauge", "order": 0, "label": "Overall Score"},
{"id": "sec-breakdown", "type": "categoryBreakdown", "order": 1, "label": "Category Breakdown"},
},
})
req, _ := http.NewRequest("POST", "https://api.verifik.co/v2/smart-report-templates/preview-html", bytes.NewReader(body))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Accept", "application/json")
req.Header.Set("Authorization", "Bearer "+os.Getenv("VERIFIK_JWT"))
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
var out map[string]interface{}
json.NewDecoder(resp.Body).Decode(&out)
fmt.Println(out)
}
curl -X POST "https://api.verifik.co/v2/smart-report-templates/preview-html" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer $VERIFIK_JWT" \
-d '{
"name": "Driver Background Preview",
"preview": true,
"score": true,
"scoreProfile": "cabify_driver",
"scoreScale": "percent",
"pageSize": "A4",
"orientation": "portrait",
"margins": { "top": 40, "right": 40, "bottom": 40, "left": 40 },
"reportTheme": "light_cards",
"sections": [
{ "id": "sec-score", "type": "scoreGauge", "order": 0, "label": "Overall Score" },
{ "id": "sec-breakdown", "type": "categoryBreakdown", "order": 1, "label": "Category Breakdown" }
]
}'
응답
- 200
- 401
- 409 (unknown_score_profile)
- 409 (MissingParameter)
{
"data": {
"html": "<!DOCTYPE html><html><head><meta charset=\"utf-8\" />...</head><body>...</body></html>",
"verificationScore": {
"profile": "cabify_driver",
"scale": "percent",
"score": 92
}
}
}
{
"message": "Unauthorized",
"code": "Unauthorized"
}
{
"message": "unknown_score_profile",
"code": "Conflict"
}
{
"message": "\"pageSize\" must be one of [A4, Letter, Legal]",
"code": "MissingParameter"
}
참고 사항
verificationScore는 검증 점수 계산이 활성화된 경우(score: true또는reportTheme에서 활성화된 경우)에만data에 포함됩니다.- 이 엔드포인트는 데이터베이스 쓰기나 Chromium 실행 없이 순수하게 메모리에서 렌더링되므로, 최종 PDF 페이지 나누기를 확인하기 위해 템플릿 샘플 다운로드를 호출하기 전에 레이아웃을 빠르게 반복 수정할 때 적합합니다.
- 미리보기한 디자인을 리포트 템플릿 생성 또는 리포트 템플릿 수정으로 저장할 때는 최상위 미리보기 도우미(
scoreScale,themeTokens,scoreSettings)를reportTheme(reportTheme.scoreScale,reportTheme.tokens,reportTheme.scoreEnabled/reportTheme.scoreProfile) 안에 배치하세요.