接口调用地址
说明:直接访问 https://api.apihz.cn/getapi.php 获取当前最优IP接口地址。由普通负载集群服务器组成,通过IP接口地址调用,如果单个服务器过载可自行切换IP接口地址尝试其他负载服务器。IP并非永久固定且容易遭受攻击,平台可能不定期更换。
说明:域名接口会自动分发请求到普通集群服务器均衡负载,该域名TTL值为60秒,表示你的请求会每60秒实现自动轮换负载服务器,但也可能因你的网络服务商存在DNS缓存造成短时间内无法自动切换负载。如果某个负载服务器出现故障,也可能会造成个别地区存在一定时间的故障期。
说明:VIP专线在普通集群组的基础上额外增加独享大带宽集群组,每次请求自动均衡负载,自动故障切换,抗攻击,全球智能CDN加速。超高稳定性!最低30¥/月,彩钻以上会员专属,登录后购买。注:VIP线路是指调用接口的线路更有保障以及每分钟拥有更高的调用频次等,并非收费接口包月使用。
请求示例
[GET]请求示例:(请登录后使用自己的KEY独享频次)
复制参数
复制全部
[POST]请求示例:(请根据开发语言自行POST,参考【GET/POST教程】,或下载【超级客户端】调试。)
请求参数说明
注意:请求编码为UTF8,否则带中文请求可能失败。一般参数不能带+号,会被自动替换为空格。参数内容较大的必须用POST,不能GET。
提示:如发现接口有BUG,可加服务QQ群及时向我们反馈。
提示:请求参数里的开发者ID与KEY,登录后台菜单【个人资料】里查看。
提示:如发现接口有BUG,可加服务QQ群及时向我们反馈。
提示:请求参数里的开发者ID与KEY,登录后台菜单【个人资料】里查看。
| 名称 | 参数 | 必填 | 说明 |
|---|---|---|---|
| 开发者ID | id | 是 | 用户中心的数字ID,例:id=10000000 |
| 开发者KEY | key | 是 | 用户中心通讯秘钥,例:key=15he5h15ty854j5sr152hs2 |
| 返回格式 | type | 是 | 返回格式1=JSON,2=TXT,例:type=1 |
| 动态秘钥 | dkey | 否 | 开发者开启动态秘钥验证后需传此参数,主要针对直接在客户端调用接口的场景。请在官网后台菜单【个人资料】里配置。例:dkey=0cd2a494831736587c33f30d1e544371 |
| 用户IP | uip | 否 | 接口调用者IP,用于后台统计IP地域分布,ISP运营商,时段IP数统计等,如不传该参数则默认为接口请求端IP,该参数主要用于使用后端服务器/中间件请求接口的方式使用。例:uip=123.123.123.123。该参数彩钻/炫钻/焱钻会员专享。 |
返回参数说明
| 名称 | 参数 | 说明 |
|---|---|---|
| 状态码 | code | 200成功,400错误 |
| 消息内容 | msg | 如果状态码返回200则msg返回图片地址,已存在于接口盒子资源库中,获取速度快,否则状态码返回400则msg返回错误信息提示。 |
| 图片大小 | size | 图片大小字节 |
| 图片标题 | title | 图片标题 |
| 图片版权 | copyright | 图片版权方,拍摄作者 |
| 拍摄日期 | datetime | 拍摄日期 |
| 描述 | explanation | 图片描述 |
| 原图普清地址 | yimg | 原图普清地址,国内下载速度不稳定。 |
| 原图高清地址 | yhdimg | 原图高清地址,国内下载速度不稳定。 |
返回数据示例
JOSN示例:{"code":400,"msg":"通讯秘钥错误。"}
JOSN示例:
{
"code": 200,
"msg": "https://res.apihz.cn/img/nasa/40/9c8fcae6a97d229abe607f00e34e4b0b.jpg",
"size": "207809",
"title": "Orion's Belt",
"copyright": "Martin Mutti, \nAstronomical Image Data\nArchive",
"datetime": "2009-02-10",
"explanation": "Alnitak, Alnilam, and Mintaka, are the bright bluish stars from east to west (left to right) along the diagonal in this gorgeous cosmic vista. Otherwise known as the Belt of Orion, these three blue supergiant stars are hotter and much more massive than the Sun. They lie about 1,500 light-years away, born of Orion's well-studied interstellar clouds. In fact, clouds of gas and dust adrift in this region have intriguing and some surprisingly familiar shapes, including the dark Horsehead Nebula and Flame Nebula near Alnitak at the lower left. The famous Orion Nebula itself lies off the bottom of this star field that covers about 4.5x3.5 degrees on the sky. This image was taken last month with a digital camera attached to a small telescope in Switzerland, and better matches human color perception than a more detailed composite taken over 15 years ago.",
"yimg": "https://apod.nasa.gov/apod/image/0902/orion_mutti.jpg",
"yhdimg": "https://apod.nasa.gov/apod/image/0902/orion_mutti_big.jpg"
}
TXT示例:https://res.apihz.cn/img/nasa/53/cdc47fda5e0bc508ccc4b7b5208cc9ec.jpg
更新记录