π‘ API Reference - CommitBang/Snapfig-Frontend GitHub Wiki
- http://:/api/v1
| λ©μλ | κ²½λ‘ | μ€λͺ |
|---|---|---|
| POST | /analyze |
PDF νμΌ μ λ‘λΒ·λΆμ |
| GET | /documents |
λΆμλ λ¬Έμ λͺ©λ‘ μ‘°ν |
| GET | /documents/{id} |
νΉμ λ¬Έμμ λ©νλ°μ΄ν° λ° νμ΄μ§ μ 보 μ‘°ν |
| GET | /documents/{id}/figures |
νΉμ λ¬Έμμ Figure λͺ©λ‘ μ‘°ν |
| POST | /auth/login |
API Key λ°κΈμ© λ‘κ·ΈμΈ (μ΅μ ) |
| POST | /graphql |
GraphQL 쿼리 μ€ν |
-
URL:
/graphql -
μμ 쿼리:
query GetDocument($id: ID!) { document(id: $id) { id metadata { title, author, pages } figures { figure_id, page_idx, confidence } } }
-
μμ μλ΅:
{ "data": { "document": { "id": "123", "metadata": { "title": "Sample", "author": "Lee", "pages": 5 }, "figures": [ { "figure_id": "1", "page_idx": 0, "confidence": 0.92 } ] } } }
- λ°κΈ: POST /auth/login (μ΄λ©μΌ/λΉλ°λ²νΈ) λλ μ΄μμ μλ λ±λ‘
- μ μ‘: λͺ¨λ μμ² ν€λμ x-api-key: <your_api_key> ν¬ν¨
curl -H "x-api-key: YOUR_API_KEY" \
-F "[email protected]" \
http://localhost:5000/api/v1/analyzecurl -X POST http://localhost:5000/api/v1/analyze \
-H "x-api-key: YOUR_API_KEY" \
-F "[email protected]"- μλ΅ (200 OK)
{ "metadata": { "title": "Doc", "author": "Kim", "pages": 10 }, "pages": [ /* ... */ ], "figures": [ /* ... */ ], "mapping_statistics": { "total_references": 12, "matched_references": 10, "match_rate": 0.83 } }
curl http://localhost:5000/api/v1/documents \
-H "x-api-key: YOUR_API_KEY"
- μλ΅ (200 OK)
[ { "id": "123", "title": "Doc1", "created_at": "2025-06-01T12:00:00Z" }, { "id": "124", "title": "Doc2", "created_at": "2025-06-02T09:30:00Z" } ]
| μ½λ | μν | μ€λͺ |
|---|---|---|
200 |
β μ±κ³΅ | μ μ μ²λ¦¬ μλ£ |
400 |
β μμ² μ€λ₯ | νμΌ μ€λ₯, μ©λ μ΄κ³Ό λ± |
500 |
π₯ μλ² μ€λ₯ | μ²λ¦¬ μ€ν¨ |