API Blueprint가 Apiary.io에서 작동하는 방식에 대한 간단한 데모를 만들려고합니다. 데모 를 위해 Mashape Weather API 의 엔드 포인트 를 블루 프린트 에 넣고 싶었습니다 .
시도는 다음과 같습니다.
http://docs.weatherapi3.apiary.io/#reference/weather/weather-data/get-the-weather-data?console=1
작동하는 것 같지만 (콘솔의 Try it out 버튼이 응답을 제공함) 다음 결과를 얻습니다.
{
"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
}
}
}
}
}
]
블루 프린트에 GET 매개 변수에 작은 실수가 있습니다. 매개 변수는 다음과 같이 작성해야합니다. {?param1,param2}
(참조 : URI 템플릿 )
그래서 당신은 단지 변경하는 경우 ## Weather data [/weatherdata{?lat}{?lng}]
에 ## Weather data [/weatherdata{?lat,lng}]
작동.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다