目录纯文本版上一节 1.8下一节 2

1.9 Get details for multiple papers at once POST /graph/v1/paper/batch

一次取回多篇论文的详情。

参数必填说明
fields否查询参数,不在 body 里
ids是JSON body:{"ids": [...]},最多 500 个
curl -X POST "https://fetchpaper.com/graph/v1/paper/batch?fields=title,year" \
     -H "Content-Type: application/json" \
     -d '{"ids":["204e3073870fae3d05bcbc2f6a8e263d9b72e776","DOI:10.1145/3437963.3441673","999999999"]}'
[{"paperId": "204e3073870fae3d05bcbc2f6a8e263d9b72e776",
  "title": "Attention is All you Need", "year": 2017},
 {"paperId": "d4d7bbf38578642eab5926733c9facc9ca1e2b0a",
  "title": "Graph Mining with Graph Neural Networks", "year": 2021},
 null]

顶层就是数组,顺序与 ids 一一对应,查不到的位置给 null(不会整批报错)。

ids 元素形态判据(两个 batch 端点同一套,实测):

元素写法结果
字符串:§1.5 任何一种(CorpusId: / DOI: / ARXIV: 前缀、裸 sha…),首尾空白被 strip按 §1.5 解析," 13756489 " 与 13756489 解到同一篇
JSON 整数,如 13756489等于它的字符串写法。必须的:响应里 externalIds.CorpusId 就是 JSON 数字,原样回传不该被判「库里没有」
null / true / false / 浮点 / 对象 / 数组该槽 null,整批仍 200。布尔不会被当成整数
位数超过 4,300 的整数400 Invalid JSON body: Exceeds the limit (4300 digits) for integer string conversion…(来自 stdlib JSON 解析,本地没放宽);4,300 位及以内解析得过,只是查不到 → null

一槽一条:同一 id 的五种写法一起提交就得到五行,不去重、长度和 ids 严格相等;ids 上限paper/batch 500、author/batch 1000,超了 400 Too many ids: 501 (max 500)。GET /graph/v1/paper/batch 回 405 Batch lookup requires POST(author/batch 同理,文案不同),batch 后面再挂路径段回 404。