2

I try this query

http://query.yahooapis.com/v1/public/yql?q=select%20item%20from%20weather.forecast%20where%20location%3D%2248907%22&format=json

with Weather API yahoo but it returns me NULL...

{"query":{"count":0,"created":"2016-12-14T12:48:16Z","lang":"fr-FR","results":null}}

I want to receive data in JSON to work with

Thanks

1 Answers1

0

The Yahoo API has changed over the last years, right now for the location you need the WOEID, that you can obtain in various ways:

select woeid from geo.places(1) where text='paris,FR'
  • Writing the previous query in the sample API search in this Yahoo site, where text must be equal to the city and country you desire.

  • The previous step can be done with a call to the API from your own program, just encode the query.

  • Clicking 'Change location' in this page and finding your desired city, once the new page loads, the WOEID will be in the browser's URL.

Once you have the code, the call to the api must be done with the following query encoded.

select * from weather.forecast where woeid = 615702 and u='c'

Where woeid is, the number you obtained and u is optional, f value returns Farenheit and c, celsius. But it's worth noting that the first returns imperial units and the second, metric.

Also, in the first link there are examples about limiting what the JSON returns, but you may want to look at the documentation they provide.

Juliosor
  • 131
  • 1
  • 8