身份驗證
POST
/api/v1/auth?action=login
獲取用於 API 訪問的 JWT 令牌。
{
"username": "your_username",
"password": "your_password"
}
// Response:
{
"success": true,
"data": {
"token": "eyJhbGciOiJIUzI1NiIs...",
"token_type": "Bearer",
"expires_in": 86400
}
}
搜尋論文
GET
/api/v1/papers?q=transformer&category=cs.AI
通過篩選和分頁搜尋論文。
curl "https://shelfhub.org/api/v1/papers?q=attention&page=1"
查詢參數:
query
category - Filter by category (e.g., cs.AI)
tag - Filter by tag
author - Author name
page - Page number (default: 1)
per_page - Results per page (max: 100)
獲取論文詳情
GET
/api/v1/papers?id=2503.12345
檢索完整的論文元數據。
// Response:
{
"success": true,
"data": {
"paper_id": "2503.12345",
"title": "Paper Title",
"abstract": "Abstract text...",
"authors": [{"name": "Author Name"}],
"categories": [{"code": "cs.AI", "name": "AI"}],
"tags": ["llm", "transformer"],
"download_url": "/api/v1/download?id=2503.12345"
}
}
上傳論文
POST
/api/v1/papers
上傳帶有元數據的新論文。
// Headers:
Authorization: Bearer YOUR_JWT_TOKEN
Content-Type: multipart/form-data
// Form Fields:
title - Paper title (required)
abstract - Abstract text
authors - JSON array: [{"name": "..."}]
categories - JSON array: ["cs.AI", "cs.LG"]
tags - JSON array: ["llm", "attention"]
pdf - PDF file
下載論文
GET
/api/v1/download?id=2503.12345
直接下載 PDF 文件。
// CLI download:
curl -L -o paper.pdf \
"https://shelfhub.org/api/v1/download?id=2503.12345"
// Or use the CLI tool:
php preprint-cli.php download 2503.12345
類別和標籤
GET
/api/v1/meta?endpoint=categories
獲取現有的類別和標籤。
// Available endpoints:
GET /api/v1/meta?endpoint=categories
GET /api/v1/meta?endpoint=tags
GET /api/v1/meta?endpoint=stats
運行狀況與狀態
GET
/api/v1/meta?endpoint=health
驗證 API 可用性和系統版本。
// Response:
{ "success": true, "data": { "status": "ok", "version": "1.0.0" } }
API 金鑰訪問
對於 CLI 工具和自動化工作流程,請使用您的 API 金鑰:
// Header format:
Authorization: Bearer YOUR_API_KEY
// Get your API key from profile after login.