Difference between revisions of "自动站数据接口"
Ringsaturn (talk | contribs) m (Tag: Visual edit) |
Ringsaturn (talk | contribs) m (Tag: Visual edit) |
||
(One intermediate revision by the same user not shown) | |||
Line 11: | Line 11: | ||
== 请求样例 == | == 请求样例 == | ||
+ | '''<u>目前仅支持返回一定距离内最多10个站点的数据。</u>''' | ||
+ | |||
简单的方式为: | 简单的方式为: | ||
Line 17: | Line 19: | ||
定制返回特定的字段,如 <code>PRE_1h</code>: | 定制返回特定的字段,如 <code>PRE_1h</code>: | ||
− | + | <code>http://api.caiyunapp.com/v1/surf/nearest/?token=TOKEN&lng=119&lat=30&fields=Station_Id_d,location,PRE_1h,pub_timestamp</code> | |
=== 返回结构和说明 === | === 返回结构和说明 === | ||
<syntaxhighlight lang="json" line="1" start="1"> | <syntaxhighlight lang="json" line="1" start="1"> | ||
{ | { | ||
− | "status":"ok", | + | "status": "ok", |
− | "result":[ | + | "result": [ |
{ | { | ||
− | "Station_Id_d": | + | "Station_Id_d": 731901, |
− | "location":{ | + | "location": { |
− | "type":"Point", | + | "type": "Point", |
− | "coordinates":[ | + | "coordinates": [ |
− | + | 116.1392, | |
− | + | 33.6767 | |
] | ] | ||
}, | }, | ||
− | "PRE_1h":"0", | + | "PRE_1h": "0", |
− | " | + | "pub_timestamp": 1603850400 |
− | |||
}, | }, | ||
{ | { | ||
− | "Station_Id_d": | + | "Station_Id_d": 736102, |
− | "location":{ | + | "location": { |
− | "type":"Point", | + | "type": "Point", |
− | "coordinates":[ | + | "coordinates": [ |
− | + | 118.7267, | |
− | + | 31.6108 | |
] | ] | ||
}, | }, | ||
− | "PRE_1h":"0", | + | "PRE_1h": "0", |
− | " | + | "pub_timestamp": 1603850400 |
− | |||
}, | }, | ||
] | ] | ||
Line 73: | Line 73: | ||
| | | | ||
| | | | ||
+ | |- | ||
+ | |<code>pub_timestamp</code> | ||
+ | |数据发布时间 | ||
+ | |int | ||
+ | | | ||
+ | |Unix 时间戳 | ||
|- | |- | ||
|<code>PRE_1h</code> | |<code>PRE_1h</code> |
Latest revision as of 03:49, 28 October 2020
本接口尚在测试与开发中,API 参数和返回结构可能会有调整。
Contents
授权与认证
请先至彩云开放平台注册,注册后可以获得 token 。
使用本接口,开发者token需要额外开通权限,请联系商务:api@caiyunapp.com
把您的 token 拼到 API 请求的 URL 中,如: http://api.caiyunapp.com/v1/surf/nearest/?token=TAkhjf8d1nlSlspN&lng=110.8840&lat=21.6594
其中 TAkhjf8d1nlSlspN
就是一个共用测试 token 。不要把私有token 告诉任何人!
请求样例
目前仅支持返回一定距离内最多10个站点的数据。
简单的方式为:
http://api.caiyunapp.com/v1/surf/nearest/?token=TAkhjf8d1nlSlspN&lng=110.8840&lat=21.6594
定制返回特定的字段,如 PRE_1h
:
返回结构和说明
1 {
2 "status": "ok",
3 "result": [
4 {
5 "Station_Id_d": 731901,
6 "location": {
7 "type": "Point",
8 "coordinates": [
9 116.1392,
10 33.6767
11 ]
12 },
13 "PRE_1h": "0",
14 "pub_timestamp": 1603850400
15 },
16 {
17 "Station_Id_d": 736102,
18 "location": {
19 "type": "Point",
20 "coordinates": [
21 118.7267,
22 31.6108
23 ]
24 },
25 "PRE_1h": "0",
26 "pub_timestamp": 1603850400
27 },
28 ]
29 }
可选字段及含义对照表
字段符号 | 字段含义 | 数据类型 | 单位 | 备注 |
---|---|---|---|---|
Station_Id_d
|
站点编号 | int | ||
location
|
站点坐标 | GeoJSON Point | ||
pub_timestamp
|
数据发布时间 | int | Unix 时间戳 | |
PRE_1h
|
最近一小时降水量 | str 形式的 float,或者 null | mm/1h
|
数据类型可能变更 |
TEM
|
温度 | str 形式的 float,或者 null | 摄氏度 | 数据类型可能变更 |
VIS
|
能见度 | str 形式的 float,或者 null | 公里 | 数据类型可能变更 |