openapi: 3.0.0
info:
title: Bangumi API
description: "你可以在 生成一个 Access Token\n建议客户端开发者指定一个带有 APP 名称和版本的 User Agent,而非使用 HTTP 请求库默认的 UA"
version: "dev"
contact:
name: Bangumi API
url: https://github.com/bangumi/api/
servers:
- url: https://api.bgm.tv
paths:
/user/{username}:
get:
tags:
- 用户
summary: 用户信息
parameters:
- $ref: "#/components/parameters/username"
responses:
200:
description: 返回用户基础信息
content:
application/json:
schema:
$ref: "#/components/schemas/User"
/user/{username}/collection:
get:
deprecated: true
tags:
- 用户
summary: 用户收藏
parameters:
- $ref: "#/components/parameters/username"
- name: cat
in: query
description: 收藏类型
watching = 在看的动画与三次元条目
all_watching = 在看的动画三次元与书籍条目
required: true
schema:
type: string
enum:
- watching
- all_watching
- name: ids
in: query
description: 收藏条目 ID
批量查询收藏状态,将条目 ID 以半角逗号分隔,如 1,2,4,6
required: false
schema:
type: string
example: 1,2,4,6
- name: responseGroup
in: query
description: medium / small
默认为 medium。small 时不返回条目详细信息
required: false
schema:
type: string
enum:
- small
- medium
default: medium
responses:
200:
description: 获取用户收藏列表,默认为在看
content:
application/json:
schema:
type: array
items:
type: object
properties:
name:
description: 番剧标题
type: string
subject_id:
description: 章节 ID
type: integer
ep_status:
description: 完成话数
type: integer
vol_status:
description: 完成卷数(书籍)
lasttouch:
description: 上次更新时间
type: integer
subject:
allOf:
- $ref: "#/components/schemas/SubjectBase"
- type: object
properties:
eps:
description: 话数
type: integer
example: 27
eps_count:
description: 话数
type: integer
example: 27
collection:
$ref: "#/components/schemas/SubjectCollection"
/user/{username}/collections/{subject_type}:
get:
deprecated: true
tags:
- 用户
summary: 用户收藏概览
parameters:
- $ref: "#/components/parameters/username"
- name: subject_type
in: path
description: 条目类型,详见 [SubjectTypeName](#model-SubjectTypeName)
required: true
schema:
$ref: "#/components/schemas/SubjectTypeName"
- $ref: "#/components/parameters/app_id"
- name: max_results
in: query
description: 显示条数
最多 25
schema:
type: integer
maximum: 25
responses:
200:
description: 获取用户指定类型的收藏概览,固定返回最近更新的收藏,不支持翻页
content:
application/json:
schema:
type: array
items:
type: object
properties:
type:
$ref: "#/components/schemas/SubjectType"
name:
$ref: "#/components/schemas/SubjectTypeName"
name_cn:
description: 条目类型中文名
type: string
example: 动画
collects:
description: 收藏列表
type: array
items:
type: object
properties:
status:
$ref: "#/components/schemas/CollectionStatus"
count:
type: integer
list:
type: array
items:
type: object
properties:
subject_id:
description: 条目 ID
type: string
subject:
$ref: "#/components/schemas/SubjectBase"
/user/{username}/collections/status:
get:
deprecated: true
tags:
- 用户
summary: 用户收藏统计
parameters:
- $ref: "#/components/parameters/username"
- $ref: "#/components/parameters/app_id"
responses:
200:
description: 获取用户所有收藏信息
content:
application/json:
schema:
type: array
items:
type: object
properties:
type:
$ref: "#/components/schemas/SubjectType"
name:
$ref: "#/components/schemas/SubjectTypeName"
name_cn:
description: 条目类型中文名
type: string
example: 动画
collects:
description: 收藏列表
type: array
items:
type: object
properties:
status:
$ref: "#/components/schemas/CollectionStatus"
count:
type: integer
/user/{username}/progress:
get:
deprecated: true
tags:
- 用户
summary: 用户收视进度
parameters:
- $ref: "#/components/parameters/username"
- name: subject_id
in: query
description: 条目 ID
获取指定条目收视进度
schema:
type: integer
responses:
200:
description: 返回用户收视进度
content:
application/json:
schema:
type: array
items:
type: object
properties:
subject_id:
description: 条目 ID
type: integer
eps:
description: 章节列表
type: array
items:
type: object
properties:
id:
description: 章节 ID
type: integer
status:
type: object
properties:
id:
$ref: "#/components/schemas/EpStatusId"
css_name:
type: string
example: Watched
url_name:
$ref: "#/components/schemas/EpStatusType"
cn_name:
$ref: "#/components/schemas/EpStatusName"
401:
description: 未授权
content:
application/json:
schema:
$ref: "#/components/schemas/StatusCode"
security:
- OptionalHTTPBearer: []
/calendar:
get:
tags:
- 条目
summary: 每日放送
responses:
200:
description: 每日放送
content:
application/json:
schema:
type: array
items:
type: object
properties:
weekday:
type: object
properties:
en:
type: string
example: Mon
cn:
type: string
example: 星期一
ja:
type: string
example: 月耀日
id:
type: integer
example: 1
items:
type: array
items:
$ref: "#/components/schemas/SubjectSmall"
/search/subject/{keywords}:
get:
tags:
- 搜索
summary: 条目搜索
parameters:
- name: keywords
in: path
description: 关键词
需要 URL Encode
required: true
schema:
type: string
- name: type
in: query
description: 条目类型,参考 [SubjectType](#model-SubjectType)
required: false
schema:
$ref: "#/components/schemas/SubjectType"
- $ref: "#/components/parameters/responseGroup"
- name: start
in: query
description: 开始条数
required: false
schema:
type: integer
- name: max_results
in: query
description: 每页条数
最多 25
required: false
schema:
type: integer
maximum: 25
responses:
200:
description: 搜索结果
content:
application/json:
schema:
type: object
properties:
results:
description: 总条数
type: integer
list:
description: 结果列表
type: array
items:
$ref: "#/components/schemas/SubjectSmall"
/ep/{id}/status/{status}:
get:
tags:
- 进度
summary: 更新收视进度
parameters:
- $ref: "#/components/parameters/ep_id"
- $ref: "#/components/parameters/ep_status"
responses:
200:
description: 成功
content:
application/json:
schema:
$ref: "#/components/schemas/StatusCode"
401:
description: 未授权
content:
application/json:
schema:
$ref: "#/components/schemas/StatusCode"
security:
- HTTPBearer: []
post:
tags:
- 进度
summary: 更新收视进度
parameters:
- $ref: "#/components/parameters/ep_id"
- $ref: "#/components/parameters/ep_status"
- name: ep_id
in: query
description: 使用 POST 批量更新
将章节以半角逗号分隔,如 `3697,3698,3699`。请求时 URL 中的 ep_id 为最后一个章节 ID
required: false
schema:
type: string
example: 3697,3698,3699
responses:
200:
description: 成功
content:
application/json:
schema:
$ref: "#/components/schemas/StatusCode"
401:
description: 未授权
content:
application/json:
schema:
$ref: "#/components/schemas/StatusCode"
security:
- HTTPBearer: []
/subject/{subject_id}/update/watched_eps:
post:
tags:
- 进度
summary: 批量更新收视进度
parameters:
- $ref: "#/components/parameters/subject_id"
- name: watched_eps
in: query
description: 如看到 123 话则 POST `123`
书籍条目传 watched_eps 与 watched_vols 至少其一
required: true
schema:
type: string
example: 123
- name: watched_vols
in: query
description: 如看到第 3 卷则 POST `3`, 仅对书籍条目有效
required: false
schema:
type: string
example: 3
responses:
200:
description: 成功
content:
application/json:
schema:
$ref: "#/components/schemas/StatusCode"
401:
description: 未授权
content:
application/json:
schema:
$ref: "#/components/schemas/StatusCode"
security:
- HTTPBearer: []
/collection/{subject_id}:
get:
tags:
- 收藏
summary: 获取指定条目收藏信息
parameters:
- $ref: "#/components/parameters/subject_id"
responses:
200:
$ref: "#/components/responses/Collection"
400:
description: 用户未收藏该条目
content:
application/json:
schema:
$ref: "#/components/schemas/StatusCode"
401:
description: 未授权
content:
application/json:
schema:
$ref: "#/components/schemas/StatusCode"
security:
- OptionalHTTPBearer: []
/collection/{subject_id}/{action}:
post:
tags:
- 收藏
summary: 管理收藏
description: "管理收藏。Content-type必须为multipart/form-data或application/x-www-form-urlencoded,参数都得放在body里。"
requestBody:
description: "必须是content-type对应的形式,不能采用Raw"
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
status: #