Using yahoo weather Api

ghost

I am using yahoo weather api and getting result using this link:

https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22london%22)&format=json

Now I want to using this url with retrofit. So please tell me how to change the city by passing query.

Thank you

Gary Bak

It would end up being something like this:

public interface WeatherService {
   @GET("v1/public/yql")
   Call<String> getWeather(@Query("q") String query);

}

Then create the object like this:

Retrofit retrofit = new Retrofit.Builder()
            .baseUrl("https://query.yahooapis.com")
            .addConverterFactory(ScalarsConverterFactory.create())
            .build();

      WeatherService wService = retrofit.create(WeatherService.class);

And run it like this:

String query = "select * from weather.forecast where woeid in (select woeid from geo.places(1) where text=\"Leeds\")&format=json";

Call<String> weather = wService.getWeather(query);
         try {
            Response<String> resp = weather.execute();

You should change the ConverterFactory to json and properly parse the weather output.

I have not tested this, just giving you an idea of how to use the Retrofit query.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Return Yahoo! weather API data in Celsius, using YQL

From Dev

Undefined namespace prefix when using yahoo weather query api

From Dev

C# with yahoo weather api

From Dev

Yahoo Weather API Key Usage?

From Dev

C# with yahoo weather api

From Dev

call yahoo weather api with nodejs

From Dev

Yahoo Weather API Key Usage?

From Dev

yahoo weather api returns null

From Dev

Yahoo Weather API implementation in Webform Application

From Dev

Making Yahoo Weather API request with OAuth 1

From Dev

Axios request to yahoo weather API failing

From Dev

Yahoo Weather API throws 'forEach' error

From Dev

Accessing Yahoo Weather API through Flash and Oauth 2.0

From Dev

how to fetch yahoo weather api json response in php

From Dev

how to substitute a javascript yahoo weather api call property with a variable

From Dev

Yahoo Weather with JSON and Java

From Dev

Yahoo Weather Query by Latitude and Longitude

From Dev

How to call yahoo weather api javascript function from within a html doc

From Dev

PHP: Yahoo Weather Api getting empty result with file_get_content

From Dev

Fetching weather data using java and the wunderground api

From Dev

show local weather using openweathermap api

From Dev

show local weather using openweathermap api

From Dev

Open map effect in the Yahoo! Weather app for iOS

From Dev

Yahoo Weather app doing the undoable - iOS

From Dev

Error when trying to parse Yahoo Weather JSON

From Dev

parse JSON weather object from Open Weather Map API using AFNetworking

From Dev

Using Webservice function in Excel to pull "Next Earnings Date" from Yahoo Finance using Yahoo API

From Dev

Can't get weather data from API using angular components

From Dev

Retrieving 5 day weather poster from openweathermap API Using Javascript

Related Related

  1. 1

    Return Yahoo! weather API data in Celsius, using YQL

  2. 2

    Undefined namespace prefix when using yahoo weather query api

  3. 3

    C# with yahoo weather api

  4. 4

    Yahoo Weather API Key Usage?

  5. 5

    C# with yahoo weather api

  6. 6

    call yahoo weather api with nodejs

  7. 7

    Yahoo Weather API Key Usage?

  8. 8

    yahoo weather api returns null

  9. 9

    Yahoo Weather API implementation in Webform Application

  10. 10

    Making Yahoo Weather API request with OAuth 1

  11. 11

    Axios request to yahoo weather API failing

  12. 12

    Yahoo Weather API throws 'forEach' error

  13. 13

    Accessing Yahoo Weather API through Flash and Oauth 2.0

  14. 14

    how to fetch yahoo weather api json response in php

  15. 15

    how to substitute a javascript yahoo weather api call property with a variable

  16. 16

    Yahoo Weather with JSON and Java

  17. 17

    Yahoo Weather Query by Latitude and Longitude

  18. 18

    How to call yahoo weather api javascript function from within a html doc

  19. 19

    PHP: Yahoo Weather Api getting empty result with file_get_content

  20. 20

    Fetching weather data using java and the wunderground api

  21. 21

    show local weather using openweathermap api

  22. 22

    show local weather using openweathermap api

  23. 23

    Open map effect in the Yahoo! Weather app for iOS

  24. 24

    Yahoo Weather app doing the undoable - iOS

  25. 25

    Error when trying to parse Yahoo Weather JSON

  26. 26

    parse JSON weather object from Open Weather Map API using AFNetworking

  27. 27

    Using Webservice function in Excel to pull "Next Earnings Date" from Yahoo Finance using Yahoo API

  28. 28

    Can't get weather data from API using angular components

  29. 29

    Retrieving 5 day weather poster from openweathermap API Using Javascript

HotTag

Archive