ping接口文档说明
⚠️ ping接口用途:检测指定目标(网站/IP)的网络连通性,返回延迟、丢包率等信息;target参数无需加http/https协议头(如填baidu.com而非https://baidu.com)
接口地址:
https://api.qyuan.asia/api/ping
请求方式:
GET(参数拼接便捷,支持POST兼容)
请求类型:
无特殊要求(浏览器/代码调用均可)
返回格式:
JSON(默认,含延迟、丢包率等详情)
接口用途:
检测目标网站/IP的网络连通性,常用于排查网站是否可访问、网络延迟情况
Header 参数
<<<<| 参数名称 |
<<<<参数类型 |
<<<<示例值 |
<<<<参数说明 |
| 无 |
— |
— |
本接口无需 Header 参数,直接调用即可 |
请求参数(Query / Body)
<<<<| 参数名称 |
<<<<参数类型 |
<<<<示例值 |
<<<<参数说明 |
| target |
string |
baidu.com / 114.114.114.114 |
必填,需检测的目标(网站域名或IP),无需加http/https协议头 |
请求示例
// 1. 检测网站(百度)
https://api.qyuan.asia/api/ping?target=baidu.com
// 2. 检测IP地址(114DNS)
https://api.qyuan.asia/api/ping?target=114.114.114.114
// 3. POST请求示例(JSON格式)
POST https://api.qyuan.asia/api/ping
Content-Type: application/json
{
"target": "api.qyuan.asia"
}
返回示例
// 1. 目标可正常访问(返回详情)
{
"code": 200,
"msg": "ping成功",
"data": {
"target": "baidu.com", // 检测目标
"targetIp": "180.101.50.242", // 目标IP
"avgDelay": "32ms", // 平均延迟
"minDelay": "28ms", // 最小延迟
"maxDelay": "38ms", // 最大延迟
"lossRate": "0%", // 丢包率(0%为正常)
"timestamp": 1740000000000 // 检测时间戳
}
}
// 2. 目标无法访问(返回错误)
{
"code": 400,
"msg": "ping失败",
"data": {
"target": "test.example.com",
"reason": "目标无法解析或网络不可达"
}
}