131 lines
3.6 KiB
Markdown
131 lines
3.6 KiB
Markdown
# CurseForge Get Mod Files API
|
||
|
||
> 来源:https://docs.curseforge.com/rest-api/
|
||
>
|
||
> API 基础地址:`https://api.curseforge.com`,认证方式:Header `x-api-key: <token>`
|
||
|
||
---
|
||
|
||
## Get Mod Files
|
||
|
||
```
|
||
GET https://api.curseforge.com/v1/mods/{modId}/files
|
||
```
|
||
|
||
获取指定项目的所有文件。
|
||
|
||
### 参数
|
||
|
||
| 参数 | 位置 | 类型 | 必填 | 说明 |
|
||
|------|------|------|------|------|
|
||
| `modId` | path | int32 | 是 | 项目 ID |
|
||
| `gameVersion` | query | string | 否 | 按游戏版本过滤 |
|
||
| `modLoaderType` | query | int | 否 | 按 Mod Loader 类型过滤(见下表) |
|
||
| `gameVersionTypeId` | query | int32 | 否 | 按 `gameVersionTypeId` 过滤 |
|
||
| `index` | query | int32 | 否 | 分页起始索引(从 0 开始,限制 `index + pageSize <= 10000`) |
|
||
| `pageSize` | query | int32 | 否 | 每页数量,默认/最大 50 |
|
||
|
||
**modLoaderType 枚举值:**
|
||
|
||
| 值 | 含义 |
|
||
|----|------|
|
||
| 0 | Any |
|
||
| 1 | Forge |
|
||
| 2 | Cauldron |
|
||
| 3 | LiteLoader |
|
||
| 4 | Fabric |
|
||
| 5 | Quilt |
|
||
| 6 | NeoForge |
|
||
|
||
### 成功响应
|
||
|
||
```jsonc
|
||
{
|
||
"data": [
|
||
{
|
||
"id": 12345, // 文件 ID
|
||
"gameId": 432, // 游戏 ID
|
||
"modId": 789, // 项目 ID
|
||
"isAvailable": true, // 是否可下载
|
||
"displayName": "My Mod v1.0", // 显示名称
|
||
"fileName": "my-mod-1.0.jar", // 文件名
|
||
"releaseType": 1, // 1=Release, 2=Beta, 3=Alpha
|
||
"fileStatus": 10, // 文件状态(见附表)
|
||
"hashes": [
|
||
{ "value": "abc123...", "algo": 1 } // algo: 1=Sha1, 2=Md5
|
||
],
|
||
"fileDate": "2025-01-01T00:00:00Z", // 文件时间戳
|
||
"fileLength": 1048576, // 文件大小(字节)
|
||
"downloadCount": 5000, // 下载次数
|
||
"fileSizeOnDisk": 1048576, // 磁盘占用
|
||
"downloadUrl": "https://...", // 下载地址
|
||
"gameVersions": ["1.21.5", "1.21.4"], // 关联的游戏版本(字符串列表)
|
||
"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 // 关系类型(见附表)
|
||
}
|
||
],
|
||
"exposeAsAlternative": false,
|
||
"parentProjectFileId": null,
|
||
"alternateFileId": null,
|
||
"isServerPack": false,
|
||
"serverPackFileId": null,
|
||
"isEarlyAccessContent": false,
|
||
"earlyAccessEndDate": null,
|
||
"fileFingerprint": 1234567890,
|
||
"modules": [
|
||
{ "name": "main", "fingerprint": 1234567890 }
|
||
]
|
||
}
|
||
],
|
||
"pagination": {
|
||
"index": 0, // 本次返回的起始索引
|
||
"pageSize": 50, // 请求的页大小
|
||
"resultCount": 1, // 本次实际返回数量
|
||
"totalCount": 10 // 总文件数
|
||
}
|
||
}
|
||
```
|
||
|
||
---
|
||
|
||
## 附表
|
||
|
||
### releaseType
|
||
|
||
| 值 | 含义 |
|
||
|----|------|
|
||
| 1 | Release |
|
||
| 2 | Beta |
|
||
| 3 | Alpha |
|
||
|
||
### relationType
|
||
|
||
| 值 | 含义 |
|
||
|----|------|
|
||
| 1 | EmbeddedLibrary |
|
||
| 2 | OptionalDependency |
|
||
| 3 | RequiredDependency |
|
||
| 4 | Tool |
|
||
| 5 | Incompatible |
|
||
| 6 | Include |
|
||
|
||
### fileStatus(常用值)
|
||
|
||
| 值 | 含义 |
|
||
|----|------|
|
||
| 1 | Processing |
|
||
| 4 | Approved |
|
||
| 10 | Released |
|
||
| 12 | Deprecated |
|