1. 接口概述与基准技术规范
SPECIFICATION & COMMUNICATION PROTOCOL
加拿大28核心数据网开放 API 接口遵循标准 RESTful 架构风格,旨在为下游应用系统、科研分析建模工具及量化监控体系提供毫秒级、零篡改的开奖流式结果与历史完整数据归档。
3189241)。本接口全生命周期支持通过期号或开奖日期执行点对点回溯。
2. 访问认证与调用频次限制
AUTHENTICATION & RATE LIMITING QUOTAS
为保障数据分发集群的稳定性并防止恶意爬取,开放平台实施基于 Token 令牌及 IP 维度的频次管控策略。调用方在发起 HTTP 请求时,须在 Request Header 中传入分配的访问密钥。
| 服务层级 (Tier) | 默认频率上限 (Rate Limit) | 历史跨度支持 (Archive Scope) | 并发连接上限 | 认证要求 |
|---|---|---|---|---|
| 沙箱体验 (Sandbox) | 60 次 / 分钟 | 最近 24 小时 | 2 并发 | 免 Token (限频IP) |
| 基础节点 (Standard) | 300 次 / 分钟 | 近 90 天归档 | 10 并发 | Token 认证 |
| 商用节点 (Enterprise) | 1,200 次 / 分钟 | 全量历史 (2015-至今) | 50 并发 | Token + IP白名单 |
系统在每一个响应中均附加标准的频次管控响应头:
X-RateLimit-Limit(总限制额度)、
X-RateLimit-Remaining(当前窗口剩余额度)、
X-RateLimit-Reset(配额重置 UNIX 时间戳)。
3. 获取最新实时开奖端点 (Latest Result)
GET /v1/draw/latest
获取最新一期加拿大28已确认的开奖结果。该接口由边缘节点执行内存级广播缓存,开奖后平均 300 毫秒内同步更新。
请求参数 (Query Parameters)
| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
| with_steps | boolean | 否 | false | 是否输出完整的20位基础球号拆分与求和步骤详情 |
| with_verify_hash | boolean | 否 | true | 是否包含用于数据验真的 SHA-256 数据指纹 |
{
"code": 200,
"status": "success",
"data": {
"issue": 3189420,
"draw_time": "2025-05-20T14:35:00+08:00",
"timestamp": 1747722900,
"confirmed_status": "confirmed",
"result": {
"num1": 4,
"num2": 8,
"num3": 2,
"sum_value": 14,
"features": {
"size": "big", // 大 (14-27) / 小 (0-13)
"parity": "even", // 单 (odd) / 双 (even)
"composite": "big_even",// 大双 / 大单 / 小双 / 小单
"extreme": "normal" // 极大 (>=22) / 极小 (<=5) / 正常 (normal)
}
},
"calculation_steps": {
"raw_balls": [2, 5, 8, 11, 14, 18, 22, 25, 29, 33, 37, 41, 45, 49, 53, 58, 62, 66, 71, 75],
"group1": {"balls": [2, 5, 8, 11, 14, 18], "sum": 58, "result_mod": 4},
"group2": {"balls": [22, 25, 29, 33, 37, 41], "sum": 187, "result_mod": 8},
"group3": {"balls": [45, 49, 53, 58, 62, 66], "sum": 333, "result_mod": 2}
},
"data_hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
},
"execution_time_ms": 4.12
}
4. 历史期号批量归档检索 (History Archive)
GET /v1/draw/history
以高效分页方式检索历史归档记录。支持指定日期检索、按期号区间范围切片以及基于升序/降序的时间序列拉取,是做走势分析及量化回测的关键端点。
请求参数 (Query Parameters)
| 参数名 | 类型 | 必填 | 默认值 | 示例与取值范围 |
|---|---|---|---|---|
| date | string | 否 | 当天 | 格式 YYYY-MM-DD,如 2025-05-20 |
| start_issue | integer | 否 | null | 起始期号(包含),如 3189000 |
| end_issue | integer | 否 | null | 结束期号(包含),如 3189100 |
| page | integer | 否 | 1 | 当前分页页码 (从 1 起始) |
| limit | integer | 否 | 50 | 每页输出条数,范围 1 ~ 200 |
| sort | string | 否 | desc | desc(最新在前)或 asc(历史在前) |
{
"code": 200,
"status": "success",
"data": {
"list": [
{
"issue": 3189419,
"draw_time": "2025-05-20T14:30:00+08:00",
"num1": 3,
"num2": 5,
"num3": 9,
"sum_value": 17,
"size": "big",
"parity": "odd",
"composite": "big_odd",
"status": "confirmed"
},
{
"issue": 3189418,
"draw_time": "2025-05-20T14:25:00+08:00",
"num1": 1,
"num2": 2,
"num3": 4,
"sum_value": 7,
"size": "small",
"parity": "odd",
"composite": "small_odd",
"status": "confirmed"
}
],
"pagination": {
"current_page": 1,
"page_size": 2,
"total_count": 288,
"total_pages": 144,
"has_next": true
}
},
"execution_time_ms": 7.84
}
5. 响应字段结构与状态确认体系
SCHEMA DATA DEFINITIONS & AUDIT STATUS
为确保分布式计算与二次消费系统的数据一致性,平台定义了严谨的字段类型映射。以下为数据实体的完整字段说明与期号状态机流转规则:
| 字段 Key | 类型 | 可空 | 取值规则 / 枚举值 | 业务语义说明 |
|---|---|---|---|---|
| issue | integer | 否 | 7~8 位连续整数 | 开奖期号唯一标识 |
| draw_time | string | 否 | ISO 8601 带时区 | 官方开出时间戳(UTC+8) |
| num1, num2, num3 | integer | 否 | 0 ~ 9 | 由前中后三区原始基础球求和取尾数得出 |
| sum_value | integer | 否 | 0 ~ 27 | num1 + num2 + num3 总和值 |
| confirmed_status | string | 否 | provisional | confirmed | corrected | 数据状态确认机状态(详见下表) |
| data_hash | string | 是 | 64-char Hex (SHA256) | 数据验真防伪哈希签名 |
开奖捕获瞬时状态(开出 0-10 秒内)。此时节点已完成基础抓取并计算,正在进行多方信源交叉对齐。
官方开奖网与 3 个独立审计节点交叉校验一致,生成唯一 hash,进入不可篡改归档库。
官方极罕见发生公布号码修正时触发。附带修正历史时间戳,严格保留版本审计痕迹。
6. 状态码与故障排查参考
HTTP STATUS & BUSINESS ERROR CODES
API 遵循标准 HTTP Status Code,并在 Response Body 的 error 字段中返回精细化的业务错误码及排查建议。
| HTTP 状态 | 业务错误码 (Code) | 错误信息 (Message) | 常见原因与处置方案 |
|---|---|---|---|
| 200 OK | SUCCESS | 请求成功 | 正常响应 |
| 400 Bad Request | ERR_INVALID_PARAM | 参数格式或范围不合法 | 检查日期格式是否为 YYYY-MM-DD 或 limit 是否超出 200 |
| 401 Unauthorized | ERR_AUTH_MISSING | 未提供或无效的 API 密钥 | 请核查请求头 Authorization 是否正确配置 Bearer Token |
| 403 Forbidden | ERR_IP_RESTRICTED | 访问受限或IP未在白名单中 | 商用节点需在控制中心绑定发起服务器的公网 IP 凭据 |
| 404 Not Found | ERR_ISSUE_NOT_FOUND | 指定期号或日期记录不存在 | 所请求期号尚未开奖,或超过了该层级允许查询的历史边界 |
| 429 Too Many Requests | ERR_RATE_LIMIT_EXCEEDED | 调用频率超过上限 | 降频重试或接入指数退避算法(Exponential Backoff) |
| 500 Server Error | ERR_INTERNAL_ERROR | 集群内部节点故障 | 联系数据中心技术客服支持,或自动切换备用灾备线路 |
7. 多语言接口调用与验真计算代码示例
DEVELOPER CODE EXAMPLES & PARSING LOGIC
为协助工程团队快速对接,以下提供 cURL、Python、PHP 及 Node.js 的标准请求示例,内置开奖计算公式与三区段求模演示代码。
curl -X GET "https://api.zh-core-jnd28.com/v1/draw/latest?with_steps=true" \
-H "Authorization: Bearer YOUR_API_TOKEN_HERE" \
-H "Accept: application/json"
curl -X GET "https://api.zh-core-jnd28.com/v1/draw/history?date=2025-05-20&limit=100&sort=asc" \
-H "Authorization: Bearer YOUR_API_TOKEN_HERE" \
-H "Accept: application/json"
import requests
API_ENDPOINT = "https://api.zh-core-jnd28.com/v1/draw/latest"
API_TOKEN = "YOUR_API_TOKEN_HERE"
headers = {
"Authorization": f"Bearer {API_TOKEN}",
"Accept": "application/json"
}
params = {
"with_steps": "true"
}
def fetch_and_verify_draw():
response = requests.get(API_ENDPOINT, headers=headers, params=params, timeout=5)
if response.status_code == 200:
data = response.json().get("data", {})
issue = data.get("issue")
result = data.get("result", {})
# 演示本地三区段算法校验
steps = data.get("calculation_steps", {})
balls = steps.get("raw_balls", [])
if len(balls) == 20:
balls.sort()
# 区段1 (球1~6), 区段2 (球7~12), 区段3 (球13~18)
g1_sum = sum(balls[0:6])
g2_sum = sum(balls[6:12])
g3_sum = sum(balls[12:18])
calc_num1 = g1_sum % 10
calc_num2 = g2_sum % 10
calc_num3 = g3_sum % 10
calc_sum = calc_num1 + calc_num2 + calc_num3
assert calc_num1 == result.get("num1")
assert calc_sum == result.get("sum_value")
print(f"期号 {issue} 验证通过! 最终和值: {calc_sum} ({result.get('features', {}).get('composite')})")
else:
print(f"请求失败: {response.status_code}, {response.text}")
if __name__ == "__main__":
fetch_and_verify_draw()
<?php
$token = 'YOUR_API_TOKEN_HERE';
$url = 'https://api.zh-core-jnd28.com/v1/draw/history?limit=50&sort=desc';
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 5,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $token,
'Accept: application/json'
]
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpCode === 200) {
$payload = json_decode($response, true);
foreach ($payload['data']['list'] as $item) {
echo sprintf(
"期号: %d | 开奖时间: %s | 结果: %d+%d+%d = %d (%s)\n",
$item['issue'],
$item['draw_time'],
$item['num1'],
$item['num2'],
$item['num3'],
$item['sum_value'],
$item['composite']
);
}
} else {
echo "接口响应异常, HTTP状态: " . $httpCode;
}
?>
import fetch from 'node-fetch';
async function getLatestDraw() {
const url = 'https://api.zh-core-jnd28.com/v1/draw/latest?with_steps=true';
const options = {
method: 'GET',
headers: {
'Authorization': 'Bearer YOUR_API_TOKEN_HERE',
'Accept': 'application/json'
}
};
try {
const response = await fetch(url, options);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
console.log(`成功获取期号: ${data.data.issue}`);
console.log(`开奖结果: ${data.data.result.num1} + ${data.data.result.num2} + ${data.data.result.num3} = ${data.data.result.sum_value}`);
console.log(`状态: ${data.data.confirmed_status}`);
} catch (error) {
console.error('API 请求出错:', error);
}
}
getLatestDraw();
抓取官方 20 个开奖基础基数并按升序排列 $B_1, B_2, \dots, B_{20}$:
- 第一区号码(Num1):第 1 至第 6 位基数总和取尾数 $\sum_{i=1}^{6} B_i \pmod{10}$
- 第二区号码(Num2):第 7 至第 12 位基数总和取尾数 $\sum_{i=7}^{12} B_i \pmod{10}$
- 第三区号码(Num3):第 13 至第 18 位基数总和取尾数 $\sum_{i=13}^{18} B_i \pmod{10}$
- 最终开奖总和(Sum):$Num_1 + Num_2 + Num_3$,取值区间严格限定于 $[0, 27]$
需要定制高频专用通道或专属商用接口?
创数智汇提供专属 WebSocket 毫秒级低延迟数据流、历史全量冷热数据库直连与定制化节点部署服务。