Skip to main content

템플릿 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-Typeapplication/json
Acceptapplication/json
AuthorizationBearer <VERIFIK_JWT>

요청 본문​

이 엔드포인트는 미리보기/점수 도우미와 모든 공개 템플릿 디자인 필드(sections, reportTheme, sampleData, margins, pageSize, orientation, pdfEngine, primaryColor, identityColor, pageBackgroundColor, logo, header, footer, legend, termsAndConditions, watermark, showPageNumbers, customFonts 등)를 허용합니다.

이름타입필수설명
namestring아니요미리보기 머리글/메타데이터에 표시할 선택적 리포트 제목.
previewboolean아니요미리보기 모드 전환. 기본값은 true입니다.
scoreboolean아니요검증 점수 계산을 활성화하고 응답에 verificationScore를 포함합니다.
scoreProfilestring아니요점수 프로필 목록 조회의 점수 프로필 ID. 최대 64자.
scoreScalestring아니요점수 표시 척도: "unit" 또는 "percent". 최상위 미리보기 도우미이며, 저장할 때는 reportTheme.scoreScale 아래에 저장하세요.
themeTokensobject아니요사용자 지정 테마 토큰 재정의. 최상위 미리보기 도우미이며, 저장할 때는 reportTheme.tokens 아래에 저장하세요.
scoreSettingsobject아니요점수 표시 설정. 최상위 미리보기 도우미이며, 저장할 때는 reportTheme(scoreEnabled, scoreProfile) 아래에 저장하세요.
sectionsobject[]아니요렌더링할 ReportSection 블록 배열.
reportThemestring / object아니요테마 프리셋 ID("premium_dark", "light_cards", "editorial", "dashboard") 또는 전체 reportTheme 구성 객체.
sampleDataobject아니요검증 샘플 페이로드(inputData, results, batchName, rowIndex). 테마/점수가 적용된 미리보기에서 생략되면 합성 드라이버 샘플이 주입됩니다.
pageSizestring아니요"A4", "Letter" 또는 "Legal". 기본값은 "A4"입니다.
orientationstring아니요"portrait" 또는 "landscape". 기본값은 "portrait"입니다.
marginsobject아니요여백 객체 `{ "top": 40, "right": 40, "bottom": 40, "left": 40 }`.

요청​

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();

응답​

{
"data": {
"html": "<!DOCTYPE html><html><head><meta charset=\"utf-8\" />...</head><body>...</body></html>",
"verificationScore": {
"profile": "cabify_driver",
"scale": "percent",
"score": 92
}
}
}

참고 사항​

  • verificationScore는 검증 점수 계산이 활성화된 경우(score: true 또는 reportTheme에서 활성화된 경우)에만 data에 포함됩니다.
  • 이 엔드포인트는 데이터베이스 쓰기나 Chromium 실행 없이 순수하게 메모리에서 렌더링되므로, 최종 PDF 페이지 나누기를 확인하기 위해 템플릿 샘플 다운로드를 호출하기 전에 레이아웃을 빠르게 반복 수정할 때 적합합니다.
  • 미리보기한 디자인을 리포트 템플릿 생성 또는 리포트 템플릿 수정으로 저장할 때는 최상위 미리보기 도우미(scoreScale, themeTokens, scoreSettings)를 reportTheme(reportTheme.scoreScale, reportTheme.tokens, reportTheme.scoreEnabled/reportTheme.scoreProfile) 안에 배치하세요.

관련 문서​