Difference between revisions of "自动站数据接口"

From Caiyun Wiki
Jump to: navigation, search
Line 11: Line 11:
  
 
== 请求样例 ==
 
== 请求样例 ==
 +
简单的方式为:
 +
 
[http://api.caiyunapp.com/v1/surf/nearest/?token=TOKEN&lng=110.8840&lat=21.6594 <code>http://api.caiyunapp.com/v1/surf/nearest/?token=TAkhjf8d1nlSlspN&lng=110.8840&lat=21.6594</code>]
 
[http://api.caiyunapp.com/v1/surf/nearest/?token=TOKEN&lng=110.8840&lat=21.6594 <code>http://api.caiyunapp.com/v1/surf/nearest/?token=TAkhjf8d1nlSlspN&lng=110.8840&lat=21.6594</code>]
  
== 返回结构和说明 ==
+
定制返回特定的字段,如 <code>PRE_1h</code>:
 +
 
 +
[http://api.caiyunapp.com/v1/surf/nearest/?token=TOKEN&lng=119&lat=30&fields=Station_Id_d,location,PRE_1h <code>http://api.caiyunapp.com/v1/surf/nearest/?token=TOKEN&lng=119&lat=30&fields=Station_Id_d,location,PRE_1h</code>]
 +
 
 +
=== 返回结构和说明 ===
 
<syntaxhighlight lang="json" line="1" start="1">
 
<syntaxhighlight lang="json" line="1" start="1">
 
{
 
{
Line 47: Line 53:
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
=== 可选字段及含义对照表 ===
 +
{| class="wikitable"
 +
!字段符号
 +
!字段含义
 +
!单位
 +
!备注
 +
|-
 +
|
 +
|
 +
|
 +
|
 +
|-
 +
|
 +
|
 +
|
 +
|
 +
|-
 +
|
 +
|
 +
|
 +
|
 +
|}

Revision as of 03:37, 28 October 2020

本接口尚在测试与开发中,API 参数和返回结构可能会有调整

授权与认证

请先至彩云开放平台注册,注册后可以获得 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 告诉任何人!

请求样例

简单的方式为:

http://api.caiyunapp.com/v1/surf/nearest/?token=TAkhjf8d1nlSlspN&lng=110.8840&lat=21.6594

定制返回特定的字段,如 PRE_1h

http://api.caiyunapp.com/v1/surf/nearest/?token=TOKEN&lng=119&lat=30&fields=Station_Id_d,location,PRE_1h

返回结构和说明

 1 {
 2   "status":"ok",
 3   "result":[
 4     {
 5       "Station_Id_d":733855,
 6       "location":{
 7         "type":"Point",
 8         "coordinates":[
 9           117.980599999999996,
10           32.0886
11         ]
12       },
13       "PRE_1h":"0",
14       "TEM":"17.9",
15       "VIS":null
16     },
17     {
18       "Station_Id_d":737567,
19       "location":{
20         "type":"Point",
21         "coordinates":[
22           117.908299999999997,
23           30.622499999999999
24         ]
25       },
26       "PRE_1h":"0",
27       "TEM":"18.5",
28       "VIS":null
29     },
30   ]
31 }

可选字段及含义对照表

字段符号 字段含义 单位 备注