为什么 Apiary 控制台没有对此 API 蓝图给出正确的响应?
Why doesn't the Apiary Console give a correct response for this API Blueprint?
我正在尝试创建一个简单的演示,说明 API Blueprint 如何与 Apiary.io 一起工作。对于演示,我想将 endpoint from the Mashape Weather API 放入蓝图中。
这是尝试:
http://docs.weatherapi3.apiary.io/#reference/weather/weather-data/get-the-weather-data?console=1
它似乎有效(意思是,控制台中的试用按钮给出了响应),但我得到了这个结果:
{
"query": {
"count": 0,
"created": "2015-06-21T11:12:06Z",
"lang": "en-US",
"results": null
}
}
通过 cURL 传递的相同结果确实给出了正确的响应,这是天气的输出。
我在蓝图中配置有误吗?
或者,Mashape 是否会阻止来自 Apiary.io 的调用?
这是蓝图:
FORMAT: 1A
HOST: https://simple-weather.p.mashape.com
# Weather API
Display Weather forecast data by latitude and longitude. Get raw weather data OR simple label description of weather forecast of some places.
# Weather API Root [/]
# Group Weather
Resources related to weather in the API.
## Weather data [/weatherdata{?lat}{?lng}]
### Get the weather data [GET]
Get the weather data in your area.
+ Parameters
+ lat: 55.749792 (required, number) - Latitude
+ lng: 37.632495 (required, number) - Longitude
+ Request JSON Message
+ Headers
X-Mashape-Authorization: {hidden in this post}
Accept: text/plain
+ Response 200 (application/json)
+ Body
[
{
"query": {
"count": 1,
"created": "2014-05-03T03:57:53Z",
"lang": "en-US",
"results": {
"channel": {
"title": "Yahoo! Weather - Tebrau, MY",
"link": "http://us.rd.yahoo.com/dailynews/rss/weather/Tebrau__MY/*http://weather.yahoo.com/forecast/MYXX0004_c.html",
"description": "Yahoo! Weather for Tebrau, MY",
"language": "en-us",
"lastBuildDate": "Sat, 03 May 2014 11:00 am MYT",
"ttl": "60",
"location": {
"city": "Tebrau",
"country": "Malaysia",
"region": ""
},
...//truncated for this post
}
}
}
}
}
]
Blueprint在GET参数中有一个小错误。参数应该这样写:{?param1,param2}
(参见:URI Templates)
所以如果你只是改变
## Weather data [/weatherdata{?lat}{?lng}]
到 ## Weather data [/weatherdata{?lat,lng}]
有效。
我正在尝试创建一个简单的演示,说明 API Blueprint 如何与 Apiary.io 一起工作。对于演示,我想将 endpoint from the Mashape Weather API 放入蓝图中。
这是尝试:
http://docs.weatherapi3.apiary.io/#reference/weather/weather-data/get-the-weather-data?console=1
它似乎有效(意思是,控制台中的试用按钮给出了响应),但我得到了这个结果:
{
"query": {
"count": 0,
"created": "2015-06-21T11:12:06Z",
"lang": "en-US",
"results": null
}
}
通过 cURL 传递的相同结果确实给出了正确的响应,这是天气的输出。
我在蓝图中配置有误吗?
或者,Mashape 是否会阻止来自 Apiary.io 的调用?
这是蓝图:
FORMAT: 1A
HOST: https://simple-weather.p.mashape.com
# Weather API
Display Weather forecast data by latitude and longitude. Get raw weather data OR simple label description of weather forecast of some places.
# Weather API Root [/]
# Group Weather
Resources related to weather in the API.
## Weather data [/weatherdata{?lat}{?lng}]
### Get the weather data [GET]
Get the weather data in your area.
+ Parameters
+ lat: 55.749792 (required, number) - Latitude
+ lng: 37.632495 (required, number) - Longitude
+ Request JSON Message
+ Headers
X-Mashape-Authorization: {hidden in this post}
Accept: text/plain
+ Response 200 (application/json)
+ Body
[
{
"query": {
"count": 1,
"created": "2014-05-03T03:57:53Z",
"lang": "en-US",
"results": {
"channel": {
"title": "Yahoo! Weather - Tebrau, MY",
"link": "http://us.rd.yahoo.com/dailynews/rss/weather/Tebrau__MY/*http://weather.yahoo.com/forecast/MYXX0004_c.html",
"description": "Yahoo! Weather for Tebrau, MY",
"language": "en-us",
"lastBuildDate": "Sat, 03 May 2014 11:00 am MYT",
"ttl": "60",
"location": {
"city": "Tebrau",
"country": "Malaysia",
"region": ""
},
...//truncated for this post
}
}
}
}
}
]
Blueprint在GET参数中有一个小错误。参数应该这样写:{?param1,param2}
(参见:URI Templates)
所以如果你只是改变
## Weather data [/weatherdata{?lat}{?lng}]
到 ## Weather data [/weatherdata{?lat,lng}]
有效。