Why doesn't the Apiary Console give a correct response for this API Blueprint?

223 views Asked by At

I'm trying to create a simple demo of how API Blueprint works with Apiary.io. For the demo, I wanted to put an endpoint from the Mashape Weather API into blueprint.

Here's the attempt:

http://docs.weatherapi3.apiary.io/#reference/weather/weather-data/get-the-weather-data?console=1

It seems to work (meaning, the Try it out button in the Console gives a response), but I get this result:

{
  "query": {
    "count": 0,
    "created": "2015-06-21T11:12:06Z",
    "lang": "en-US",
    "results": null
  }
} 

The same result passed via cURL does give a correct response, which is an output of the weather.

Is there something I am misconfiguring in the blueprint?

Alternatively, does Mashape block calls from Apiary.io?

Here's the blueprint:

 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
                }
              }
            }
          }
        }
             ]
1

There are 1 answers

1
JackuB On BEST ANSWER

There is a tiny mistake in Blueprint in GET parameters. Parameters should be written like: {?param1,param2} (See: URI Templates)

So if you just change ## Weather data [/weatherdata{?lat}{?lng}] to ## Weather data [/weatherdata{?lat,lng}] it works.