Skip to content

API 레퍼런스

david010420 edited this page Jun 15, 2025 · 3 revisions

Base URL

http://<host>:<port>/api/v1

📌 주요 REST 엔드포인트

메서드 경로 설명
POST /process PDF 파일 업로드 및 분석 수행
POST /summarize/text 텍스트 본문 요약
POST /summarize/figure PDF 내 특정 Figure에 대한 요약 생성

🔐 인증 방식 (옵션)

현재 이 API는 인증 없이 접근 가능합니다. (향후 x-api-key 헤더를 통해 확장 가능)


📤 요청/응답 예시

1. PDF 분석 요청

Request

curl -X POST http://localhost:5000/api/v1/process \
  -F "file=@sample.pdf"

Response

{
  "interactive_elements": [
    {
      "type": "figure",
      "xref": 5,
      "page": 2,
      "bbox": [100.0, 200.0, 300.0, 400.0]
    },
    {
      "type": "reference",
      "ref_id": "Fig. 1",
      "page": 1,
      "text": "as shown in Fig. 1"
    }
  ],
  "paragraph_data": {
    "metadata": { "title": "Sample", "pages": 5 },
    "pages": [
      {
        "page_idx": 0,
        "blocks": [ ... ]
      }
    ]
  }
}

2. 텍스트 요약 요청

Request

curl -X POST http://localhost:5000/api/v1/summarize/text \
  -H "Content-Type: application/json" \
  -d '{"text": "This is a long paragraph to be summarized..."}'

Response

{
  "summary": "Summarized version of the input text."
}

3. Figure 요약 요청

Request

curl -X POST http://localhost:5000/api/v1/summarize/figure \
  -H "Content-Type: application/json" \
  -d '{"pdf_filename": "sample.pdf", "xref": 5}'

Response

{
  "summary": "This figure shows a comparison between..."
}

📋 응답 코드

코드 상태 설명
200 ✅ 성공 요청이 정상적으로 처리됨
400 ❌ 잘못된 요청 필수 입력 누락, 파일 형식 오류 등
500 🔥 서버 오류 내부 처리 중 예외 발생
503 ⚠️ 외부 요약 실패 외부 서비스 호출 실패(예: LLM 등) 시 반환됨

Clone this wiki locally