330 lines
11 KiB
Markdown
330 lines
11 KiB
Markdown
|
|
# CurseForge Get Mod API
|
|||
|
|
|
|||
|
|
> 来源:https://docs.curseforge.com/rest-api/
|
|||
|
|
>
|
|||
|
|
> API 基础地址:`https://api.curseforge.com`,认证方式:Header `x-api-key: <token>`
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## Get Mod
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
GET https://api.curseforge.com/v1/mods/{modId}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
获取指定项目的详细信息。
|
|||
|
|
|
|||
|
|
### 参数
|
|||
|
|
|
|||
|
|
| 参数 | 位置 | 类型 | 必填 | 说明 |
|
|||
|
|
|------|------|------|------|------|
|
|||
|
|
| `modId` | path | int32 | 是 | 项目 ID |
|
|||
|
|
|
|||
|
|
### 成功响应
|
|||
|
|
|
|||
|
|
```jsonc
|
|||
|
|
{
|
|||
|
|
"data": {
|
|||
|
|
"id": 789, // 项目 ID
|
|||
|
|
"gameId": 432, // 游戏 ID
|
|||
|
|
"name": "My Mod", // 项目名称
|
|||
|
|
"slug": "my-mod", // URL 中的项目标识
|
|||
|
|
"links": { // 相关链接(见 ModLinks)
|
|||
|
|
"websiteUrl": "https://...", // 官网
|
|||
|
|
"wikiUrl": "https://...", // Wiki
|
|||
|
|
"issuesUrl": "https://...", // Issue 追踪
|
|||
|
|
"sourceUrl": "https://..." // 源码仓库
|
|||
|
|
},
|
|||
|
|
"summary": "A mod that does stuff.", // 项目简介
|
|||
|
|
"status": 4, // 项目状态(见 ModStatus)
|
|||
|
|
"downloadCount": 50000, // 下载次数
|
|||
|
|
"isFeatured": false, // 是否精选项目
|
|||
|
|
"primaryCategoryId": 1, // 主分类 ID
|
|||
|
|
"categories": [ // 分类列表(见 Category)
|
|||
|
|
{
|
|||
|
|
"id": 1, // 分类 ID
|
|||
|
|
"gameId": 432, // 游戏 ID
|
|||
|
|
"name": "MC Technology", // 分类名称
|
|||
|
|
"slug": "technology", // 分类标识
|
|||
|
|
"url": "https://...", // 分类页面 URL
|
|||
|
|
"iconUrl": "https://...", // 分类图标 URL
|
|||
|
|
"dateModified": "2025-01-01T00:00:00Z",
|
|||
|
|
"isClass": false,
|
|||
|
|
"classId": null,
|
|||
|
|
"parentCategoryId": null,
|
|||
|
|
"displayIndex": 0
|
|||
|
|
}
|
|||
|
|
],
|
|||
|
|
"classId": null, // 所属 class ID
|
|||
|
|
"authors": [ // 作者列表(见 ModAuthor)
|
|||
|
|
{
|
|||
|
|
"id": 123, // 作者 ID
|
|||
|
|
"name": "AuthorName", // 作者名
|
|||
|
|
"url": "https://..." // 作者页面 URL
|
|||
|
|
}
|
|||
|
|
],
|
|||
|
|
"logo": { // Logo 资源(见 ModAsset)
|
|||
|
|
"id": 100, // 资源 ID
|
|||
|
|
"modId": 789, // 所属项目 ID
|
|||
|
|
"title": "Logo Title", // 资源标题
|
|||
|
|
"description": "Logo description", // 资源描述
|
|||
|
|
"thumbnailUrl": "https://...", // 缩略图 URL
|
|||
|
|
"url": "https://..." // 原图 URL
|
|||
|
|
},
|
|||
|
|
"screenshots": [ // 截图列表(见 ModAsset)
|
|||
|
|
{
|
|||
|
|
"id": 101,
|
|||
|
|
"modId": 789,
|
|||
|
|
"title": "Screenshot 1",
|
|||
|
|
"description": "A screenshot",
|
|||
|
|
"thumbnailUrl": "https://...",
|
|||
|
|
"url": "https://..."
|
|||
|
|
}
|
|||
|
|
],
|
|||
|
|
"mainFileId": 12345, // 主文件 ID
|
|||
|
|
"latestFiles": [ // 最新文件列表(File,详见 get.md)
|
|||
|
|
{
|
|||
|
|
"id": 12345, // 文件 ID
|
|||
|
|
"gameId": 432, // 游戏 ID
|
|||
|
|
"modId": 789, // 项目 ID
|
|||
|
|
"isAvailable": true, // 是否可下载
|
|||
|
|
"displayName": "My Mod v1.0", // 显示名称
|
|||
|
|
"fileName": "my-mod-1.0.jar", // 文件名
|
|||
|
|
"releaseType": 1, // FileReleaseType
|
|||
|
|
"fileStatus": 10, // FileStatus
|
|||
|
|
"hashes": [
|
|||
|
|
{ "value": "abc123...", "algo": 1 } // FileHash
|
|||
|
|
],
|
|||
|
|
"fileDate": "2025-01-01T00:00:00Z", // 文件时间戳
|
|||
|
|
"fileLength": 1048576, // 文件大小(字节)
|
|||
|
|
"downloadCount": 5000, // 下载次数
|
|||
|
|
"fileSizeOnDisk": 1048576, // 磁盘占用
|
|||
|
|
"downloadUrl": "https://...", // 下载地址
|
|||
|
|
"gameVersions": ["1.21.5"], // 关联的游戏版本(字符串列表)
|
|||
|
|
"sortableGameVersions": [
|
|||
|
|
{
|
|||
|
|
"gameVersionName": "1.21.5",
|
|||
|
|
"gameVersionPadded": "0000000001.0000000021.0000000005",
|
|||
|
|
"gameVersion": "1.21.5",
|
|||
|
|
"gameVersionReleaseDate": "2025-04-01T00:00:00Z",
|
|||
|
|
"gameVersionTypeId": 83806
|
|||
|
|
}
|
|||
|
|
],
|
|||
|
|
"dependencies": [
|
|||
|
|
{
|
|||
|
|
"modId": 123, // 依赖的项目 ID
|
|||
|
|
"relationType": 3 // FileRelationType
|
|||
|
|
}
|
|||
|
|
],
|
|||
|
|
"exposeAsAlternative": false,
|
|||
|
|
"parentProjectFileId": null,
|
|||
|
|
"alternateFileId": null,
|
|||
|
|
"isServerPack": false,
|
|||
|
|
"serverPackFileId": null,
|
|||
|
|
"isEarlyAccessContent": false,
|
|||
|
|
"earlyAccessEndDate": null,
|
|||
|
|
"fileFingerprint": 1234567890,
|
|||
|
|
"modules": [
|
|||
|
|
{ "name": "main", "fingerprint": 1234567890 }
|
|||
|
|
]
|
|||
|
|
}
|
|||
|
|
],
|
|||
|
|
"latestFilesIndexes": [ // 最新文件索引(见 FileIndex)
|
|||
|
|
{
|
|||
|
|
"gameVersion": "1.21.5", // 游戏版本
|
|||
|
|
"fileId": 12345, // 文件 ID
|
|||
|
|
"filename": "my-mod-1.0.jar", // 文件名
|
|||
|
|
"releaseType": 1, // FileReleaseType
|
|||
|
|
"gameVersionTypeId": 83806, // 版本类型 ID
|
|||
|
|
"modLoader": 1 // ModLoaderType
|
|||
|
|
}
|
|||
|
|
],
|
|||
|
|
"latestEarlyAccessFilesIndexes": [], // 最新抢先体验文件索引(见 FileIndex)
|
|||
|
|
"dateCreated": "2024-01-01T00:00:00Z", // 创建时间
|
|||
|
|
"dateModified": "2025-06-01T00:00:00Z", // 最后修改时间
|
|||
|
|
"dateReleased": "2024-02-01T00:00:00Z", // 发布时间
|
|||
|
|
"allowModDistribution": true, // 是否允许分发
|
|||
|
|
"gamePopularityRank": 42, // 游戏内热门排名
|
|||
|
|
"isAvailable": true, // 是否可被搜索到
|
|||
|
|
"thumbsUpCount": 1234, // 点赞数
|
|||
|
|
"rating": 4.5 // 评分
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
### 响应字段
|
|||
|
|
|
|||
|
|
| 字段 | 类型 | 说明 |
|
|||
|
|
|------|------|------|
|
|||
|
|
| `id` | int32 | 项目 ID |
|
|||
|
|
| `gameId` | int32 | 游戏 ID |
|
|||
|
|
| `name` | string | 项目名称 |
|
|||
|
|
| `slug` | string | URL 中的项目标识 |
|
|||
|
|
| `links` | ModLinks | 相关链接(官网、Wiki、Issue、源码) |
|
|||
|
|
| `summary` | string | 项目简介 |
|
|||
|
|
| `status` | ModStatus | 项目状态(见 ModStatus 附表) |
|
|||
|
|
| `downloadCount` | int64 | 下载总次数 |
|
|||
|
|
| `isFeatured` | boolean | 是否为精选项目 |
|
|||
|
|
| `primaryCategoryId` | int32 | 作者选择的主分类 ID |
|
|||
|
|
| `categories` | Category[] | 关联的分类列表(见 Category 附表) |
|
|||
|
|
| `classId` | int32 \| null | 所属 class ID |
|
|||
|
|
| `authors` | ModAuthor[] | 作者列表(见 ModAuthor 附表) |
|
|||
|
|
| `logo` | ModAsset | Logo 资源(见 ModAsset 附表) |
|
|||
|
|
| `screenshots` | ModAsset[] | 截图资源列表(见 ModAsset 附表) |
|
|||
|
|
| `mainFileId` | int32 | 主文件 ID |
|
|||
|
|
| `latestFiles` | File[] | 最新文件列表(File 定义详见 get.md) |
|
|||
|
|
| `latestFilesIndexes` | FileIndex[] | 最新文件索引(见 FileIndex 附表) |
|
|||
|
|
| `latestEarlyAccessFilesIndexes` | FileIndex[] | 最新抢先体验文件索引(见 FileIndex 附表) |
|
|||
|
|
| `dateCreated` | string (date-time) | 创建时间(ISO 8601) |
|
|||
|
|
| `dateModified` | string (date-time) | 最后修改时间(ISO 8601) |
|
|||
|
|
| `dateReleased` | string (date-time) | 发布时间(ISO 8601) |
|
|||
|
|
| `allowModDistribution` | boolean \| null | 是否允许分发 |
|
|||
|
|
| `gamePopularityRank` | int32 | 游戏内热门排名 |
|
|||
|
|
| `isAvailable` | boolean | 是否可被搜索到(实验性、已删除或仅有 Alpha 文件时可能为 false) |
|
|||
|
|
| `thumbsUpCount` | int32 | 点赞数 |
|
|||
|
|
| `rating` | number (decimal) \| null | 评分 |
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## 子类型
|
|||
|
|
|
|||
|
|
### ModLinks
|
|||
|
|
|
|||
|
|
| 字段 | 类型 | 说明 |
|
|||
|
|
|------|------|------|
|
|||
|
|
| `websiteUrl` | string | 官网链接 |
|
|||
|
|
| `wikiUrl` | string | Wiki 链接 |
|
|||
|
|
| `issuesUrl` | string | Issue 追踪链接 |
|
|||
|
|
| `sourceUrl` | string | 源码仓库链接 |
|
|||
|
|
|
|||
|
|
### ModAuthor
|
|||
|
|
|
|||
|
|
| 字段 | 类型 | 说明 |
|
|||
|
|
|------|------|------|
|
|||
|
|
| `id` | int32 | 作者 ID |
|
|||
|
|
| `name` | string | 作者名 |
|
|||
|
|
| `url` | string | 作者页面 URL |
|
|||
|
|
|
|||
|
|
### ModAsset
|
|||
|
|
|
|||
|
|
| 字段 | 类型 | 说明 |
|
|||
|
|
|------|------|------|
|
|||
|
|
| `id` | int32 | 资源 ID |
|
|||
|
|
| `modId` | int32 | 所属项目 ID |
|
|||
|
|
| `title` | string | 资源标题 |
|
|||
|
|
| `description` | string | 资源描述 |
|
|||
|
|
| `thumbnailUrl` | string | 缩略图 URL |
|
|||
|
|
| `url` | string | 原图 URL |
|
|||
|
|
|
|||
|
|
### Category
|
|||
|
|
|
|||
|
|
| 字段 | 类型 | 说明 |
|
|||
|
|
|------|------|------|
|
|||
|
|
| `id` | int32 | 分类 ID |
|
|||
|
|
| `gameId` | int32 | 关联的游戏 ID |
|
|||
|
|
| `name` | string | 分类名称 |
|
|||
|
|
| `slug` | string | URL 中的分类标识 |
|
|||
|
|
| `url` | string | 分类页面 URL |
|
|||
|
|
| `iconUrl` | string | 分类图标 URL |
|
|||
|
|
| `dateModified` | string (date-time) | 最后修改时间(ISO 8601) |
|
|||
|
|
| `isClass` | boolean \| null | 是否为顶层分类(可包含其他分类) |
|
|||
|
|
| `classId` | int32 \| null | 所属 class ID |
|
|||
|
|
| `parentCategoryId` | int32 \| null | 父分类 ID |
|
|||
|
|
| `displayIndex` | int32 \| null | 显示排序索引 |
|
|||
|
|
|
|||
|
|
### FileIndex
|
|||
|
|
|
|||
|
|
| 字段 | 类型 | 说明 |
|
|||
|
|
|------|------|------|
|
|||
|
|
| `gameVersion` | string | 游戏版本 |
|
|||
|
|
| `fileId` | int32 | 文件 ID |
|
|||
|
|
| `filename` | string | 文件名 |
|
|||
|
|
| `releaseType` | FileReleaseType | 发布类型(见 FileReleaseType 枚举) |
|
|||
|
|
| `gameVersionTypeId` | int32 \| null | 版本类型 ID |
|
|||
|
|
| `modLoader` | ModLoaderType | Mod Loader 类型(见 ModLoaderType 枚举) |
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## 枚举
|
|||
|
|
|
|||
|
|
### ModStatus
|
|||
|
|
|
|||
|
|
| 值 | 含义 |
|
|||
|
|
|----|------|
|
|||
|
|
| 1 | New |
|
|||
|
|
| 2 | ChangesRequired |
|
|||
|
|
| 3 | UnderSoftReview |
|
|||
|
|
| 4 | Approved |
|
|||
|
|
| 5 | Rejected |
|
|||
|
|
| 6 | ChangesMade |
|
|||
|
|
| 7 | Inactive |
|
|||
|
|
| 8 | Abandoned |
|
|||
|
|
| 9 | Deleted |
|
|||
|
|
| 10 | UnderReview |
|
|||
|
|
|
|||
|
|
### FileReleaseType
|
|||
|
|
|
|||
|
|
| 值 | 含义 |
|
|||
|
|
|----|------|
|
|||
|
|
| 1 | Release |
|
|||
|
|
| 2 | Beta |
|
|||
|
|
| 3 | Alpha |
|
|||
|
|
|
|||
|
|
### FileRelationType
|
|||
|
|
|
|||
|
|
| 值 | 含义 |
|
|||
|
|
|----|------|
|
|||
|
|
| 1 | EmbeddedLibrary |
|
|||
|
|
| 2 | OptionalDependency |
|
|||
|
|
| 3 | RequiredDependency |
|
|||
|
|
| 4 | Tool |
|
|||
|
|
| 5 | Incompatible |
|
|||
|
|
| 6 | Include |
|
|||
|
|
|
|||
|
|
### FileStatus
|
|||
|
|
|
|||
|
|
| 值 | 含义 |
|
|||
|
|
|----|------|
|
|||
|
|
| 1 | Processing |
|
|||
|
|
| 2 | ChangesRequired |
|
|||
|
|
| 3 | UnderReview |
|
|||
|
|
| 4 | Approved |
|
|||
|
|
| 5 | Rejected |
|
|||
|
|
| 6 | MalwareDetected |
|
|||
|
|
| 7 | Deleted |
|
|||
|
|
| 8 | Archived |
|
|||
|
|
| 9 | Testing |
|
|||
|
|
| 10 | Released |
|
|||
|
|
| 11 | ReadyForReview |
|
|||
|
|
| 12 | Deprecated |
|
|||
|
|
| 13 | Baking |
|
|||
|
|
| 14 | AwaitingPublishing |
|
|||
|
|
| 15 | FailedPublishing |
|
|||
|
|
| 16 | Cooking |
|
|||
|
|
| 17 | Cooked |
|
|||
|
|
| 18 | UnderManualReview |
|
|||
|
|
| 19 | ScanningForMalware |
|
|||
|
|
| 20 | ProcessingFile |
|
|||
|
|
| 21 | PendingRelease |
|
|||
|
|
| 22 | ReadyForCooking |
|
|||
|
|
| 23 | PostProcessing |
|
|||
|
|
|
|||
|
|
### HashAlgo
|
|||
|
|
|
|||
|
|
| 值 | 含义 |
|
|||
|
|
|----|------|
|
|||
|
|
| 1 | Sha1 |
|
|||
|
|
| 2 | Md5 |
|
|||
|
|
|
|||
|
|
### ModLoaderType
|
|||
|
|
|
|||
|
|
| 值 | 含义 |
|
|||
|
|
|----|------|
|
|||
|
|
| 0 | Any |
|
|||
|
|
| 1 | Forge |
|
|||
|
|
| 2 | Cauldron |
|
|||
|
|
| 3 | LiteLoader |
|
|||
|
|
| 4 | Fabric |
|
|||
|
|
| 5 | Quilt |
|
|||
|
|
| 6 | NeoForge |
|