状态
GET /v1/health — CSBoard API 存活与新鲜度探针
检查 CSBoard API 是否可达,以及价格列表的陈旧程度。无需 API 密钥即可调用——可以安全地匿名轮询。
GET
/
health
Liveness + freshness probe
curl --request GET \
--url https://csboard.com/v1/healthimport requests
url = "https://csboard.com/v1/health"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://csboard.com/v1/health', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://csboard.com/v1/health",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://csboard.com/v1/health"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://csboard.com/v1/health")
.asString();require 'uri'
require 'net/http'
url = URI("https://csboard.com/v1/health")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"status": "ok",
"groups": 184213,
"price_list_age_seconds": 42
}health 端点是一个轻量级探针,用于确认 API 是否可达,并告诉您实体化的价格列表有多陈旧。它无需 API 密钥即可工作——另一个无需密钥的端点是公开价格数据源——因此非常适合从监控系统轮询,或在执行已认证调用前在应用启动阶段进行新鲜度检查。
响应字段
string
必填
服务正常时始终为
"ok"。integer
必填
当前价格列表中已定价的商品组数量(每个唯一的
market_hash_name + wear + doppler_phase 组合算一组)。integer
必填
实体化价格列表的年龄,以秒为单位。请将其作为新鲜度指标——数值过大意味着价格可能滞后。
示例请求
curl https://csboard.com/v1/health
示例响应
{
"status": "ok",
"groups": 184213,
"price_list_age_seconds": 42
}
错误代码
| HTTP 状态码 | 代码 | 含义 |
|---|---|---|
| 429 | rate_limit_exceeded | 超过请求速率限制。请退避后按 Retry-After 响应头中的秒数重试。 |
在执行已认证调用之前,请在健康检查或启动逻辑中轮询此端点。如果
price_list_age_seconds 出乎意料地大(例如超过几分钟),请将下游价格数据视为可能已陈旧。⌘I
Liveness + freshness probe
curl --request GET \
--url https://csboard.com/v1/healthimport requests
url = "https://csboard.com/v1/health"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://csboard.com/v1/health', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://csboard.com/v1/health",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://csboard.com/v1/health"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://csboard.com/v1/health")
.asString();require 'uri'
require 'net/http'
url = URI("https://csboard.com/v1/health")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"status": "ok",
"groups": 184213,
"price_list_age_seconds": 42
}