openapi: 3.0.0
info:
title: Bangumi API
description: |
你可以在 生成一个 Access Token
## 建议客户端开发者指定一个带有 APP 名称和版本的 User Agent,而非使用 HTTP 请求库默认的 UA
各种请求库的默认 UA 在未来可能会被禁用。
version: "dev"
contact:
name: Bangumi API
url: https://github.com/bangumi/api/
servers:
- url: https://api.bgm.tv
paths:
/user/{username}/collections/status:
get:
deprecated: true
tags:
- 用户
summary: 用户收藏统计
operationId: getUserCollectionStatusByUsername
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: "v0.yaml#/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: 用户收视进度
operationId: getUserProgressByUsername
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: 每日放送
operationId: getCalendar
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: 条目搜索
operationId: searchSubjectByKeywords
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: "v0.yaml#/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: 更新收视进度
operationId: getEpisodeStatus
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: 更新收视进度
operationId: UpdateEpisodeStatus
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: 批量更新收视进度
operationId: batchUpdateEpisodeStatusBySubjectId
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}/{action}:
post:
tags:
- 收藏
summary: 管理收藏
operationId: UpdateCollectionBySubjectIdWithAction
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: #