API v1.0 · 稳定版
大王插件市场 开放 API
通过 REST API 接入 大王插件市场 插件生态,获取插件数据、搜索插件、触发下载, 轻松集成到您的应用、机器人或自动化脚本中。
Base URL
https://cjsc.wmhbd.cn/api/
2
插件数量
0
总下载量
4
注册用户
6
插件分类
认证方式
大多数只读接口(列表、详情、分类、统计)无需认证即可调用。 仅 下载 等写操作需要在请求头携带 API Key。
方式一:Header(推荐)
X-API-Key: ph_your_api_key_here
方式二:Bearer Token
Authorization: Bearer ph_your_api_key_here
在账户设置中可创建最多 5 个 API Key,建议为每个应用创建独立的 Key 便于管理。
插件接口
GET
https://cjsc.wmhbd.cn/api/?r=plugins
无需认证
获取已审核通过的插件列表,支持分页、关键字搜索、分类过滤和排序。
查询参数
| 参数名 | 类型 | 必填 | 说明 | 默认值 |
|---|---|---|---|---|
| page | integer | 否 | 页码 | 1 |
| per_page | integer | 否 | 每页数量(1-100) | 12 |
| keyword | string | 否 | 搜索关键字(名称/描述/作者/标签) | — |
| category | string | 否 | 分类 slug,如 tools | — |
| sort | string | 否 | latest | downloads | name | latest |
| tag | string | 否 | 按标签筛选 | — |
| api_key | string | 否 | API Key(可选,用于统计调用量) | — |
请求示例
GET https://cjsc.wmhbd.cn/api/?r=plugins&page=1&per_page=10&keyword=管理&sort=downloads
GET
https://cjsc.wmhbd.cn/api/?r=plugins&action=detail&id={id}
无需认证
获取指定插件详细信息,同时增加浏览量计数。
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| id | integer | 是 | 插件 ID |
GET https://cjsc.wmhbd.cn/api/?r=plugins&action=detail&id=1
GET
https://cjsc.wmhbd.cn/api/?r=plugins&action=download&id={id}
需要 API Key
获取插件下载地址,同时记录下载量。需在请求头携带有效 API Key。
GET https://cjsc.wmhbd.cn/api/?r=plugins&action=download&id=1
X-API-Key: ph_your_api_key_here
分类接口
GET
https://cjsc.wmhbd.cn/api/?r=categories
无需认证
获取所有分类及各分类下已审核插件数量。
GET https://cjsc.wmhbd.cn/api/?r=categories
统计接口
GET
https://cjsc.wmhbd.cn/api/?r=stats
无需认证
获取平台整体统计数据,包括总插件数、总下载量、今日新增和下载量 Top5。
GET https://cjsc.wmhbd.cn/api/?r=stats
统一响应格式
所有接口均返回 JSON 格式,结构如下:
✅ 成功响应
{
"code": 0,
"message": "ok",
"data": { /* 业务数据 */ }
}
❌ 错误响应
{
"code": 401,
"message": "无效的 API Key",
"data": null
}
列表接口分页结构
{
"code": 0,
"message": "ok",
"data": {
"list": [ /* 插件数组 */ ],
"pagination": {
"total": 128, // 总记录数
"page": 1, // 当前页
"per_page": 12, // 每页数量
"total_pages": 11 // 总页数
}
}
}
错误码说明
| HTTP 状态码 | code 字段 | 含义 | 解决方式 |
|---|---|---|---|
| 200 | 0 | 请求成功 | — |
| 400 | 1 | 参数错误 | 检查 action、id 等参数 |
| 401 | 401 | 缺少或无效的 API Key | 检查请求头 X-API-Key |
| 403 | 403 | Key 已禁用或账号被封 | 联系管理员或重新生成 Key |
| 404 | 404 | 资源不存在 | 检查 id 是否正确 |
| 500 | 500 | 服务器内部错误 | 请稍后重试 |
代码示例
import requests
API_BASE = "https://cjsc.wmhbd.cn/api/"
API_KEY = "ph_your_api_key_here"
HEADERS = {"X-API-Key": API_KEY}
# 获取插件列表
resp = requests.get(API_BASE, params={"r": "plugins", "keyword": "管理", "per_page": 10})
data = resp.json()
print(data["data"]["pagination"]["total"], "个插件")
for p in data["data"]["list"]:
print(p["name"], "-", p["download_count"], "次下载")
# 获取插件详情
resp = requests.get(API_BASE, params={"r": "plugins", "action": "detail", "id": 1})
plugin = resp.json()["data"]
print(plugin["name"], plugin["version"])
# 获取下载链接(需要 Key)
resp = requests.get(API_BASE, headers=HEADERS,
params={"r": "plugins", "action": "download", "id": 1})
print(resp.json()["data"]["download_url"])
const API_BASE = 'https://cjsc.wmhbd.cn/api/';
const API_KEY = 'ph_your_api_key_here';
// 获取插件列表
async function getPlugins(keyword = '', page = 1) {
const url = new URL(API_BASE);
url.searchParams.set('r', 'plugins');
url.searchParams.set('keyword', keyword);
url.searchParams.set('page', page);
const res = await fetch(url);
const json = await res.json();
return json.data;
}
// 获取下载链接(需要 Key)
async function downloadPlugin(id) {
const url = new URL(API_BASE);
url.searchParams.set('r', 'plugins');
url.searchParams.set('action', 'download');
url.searchParams.set('id', id);
const res = await fetch(url, { headers: { 'X-API-Key': API_KEY } });
const json = await res.json();
return json.data.download_url;
}
getPlugins('管理').then(d => console.log(`共 ${d.pagination.total} 个插件`));
<?php
$apiBase = 'https://cjsc.wmhbd.cn/api/';
$apiKey = 'ph_your_api_key_here';
// 获取插件列表
$url = $apiBase . '?r=plugins&keyword=管理&per_page=10';
$json = json_decode(file_get_contents($url), true);
foreach ($json['data']['list'] as $p) {
echo $p['name'] . "\n";
}
// 获取下载链接(用 cURL 携带 Header)
$ch = curl_init($apiBase . '?r=plugins&action=download&id=1');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-Key: ' . $apiKey],
]);
$result = json_decode(curl_exec($ch), true);
curl_close($ch);
echo $result['data']['download_url'];
# 获取插件列表
curl "https://cjsc.wmhbd.cn/api/?r=plugins&per_page=10&sort=downloads"
# 搜索插件
curl "https://cjsc.wmhbd.cn/api/?r=plugins&keyword=管理&category=tools"
# 获取插件详情
curl "https://cjsc.wmhbd.cn/api/?r=plugins&action=detail&id=1"
# 获取下载链接(需 Key)
curl -H "X-API-Key: ph_your_api_key_here" \
"https://cjsc.wmhbd.cn/api/?r=plugins&action=download&id=1"
# 获取所有分类
curl "https://cjsc.wmhbd.cn/api/?r=categories"
# 获取平台统计
curl "https://cjsc.wmhbd.cn/api/?r=stats"
在线快速测试
请求中...