身份验证
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.