2016-11-22 56 views
0

我想在一個API調用中獲取一個或多個位置的天氣信息?可這有可能在http://api.worldweatheronline.com/free/v1/weather.ashx我們可以從Worldweatheronline api獲得多個天氣數據嗎?

http://api.worldweatheronline.com/premium/v1/weather.ashx?key=[APIKey]&q=London&format=json&num_of_days=5 返回的結果爲倫敦城市 但是當我的PaaS數據像 http://api.worldweatheronline.com/premium/v1/weather.ashx?key=[APIKey]&q=London,India&format=json&num_of_days=5

那麼它是不是對倫敦和提供JSON逗號分隔值印度,堅果提供與倫敦城市僅相同的上述鏈接。

有人可以告訴我api調用還是可以在一次調用中獲取所有城市的數據?

由於

+1

發送多個請求? – ChrisBint

+0

你在接聽或詢問嗎? – SigarDave

+0

@ChrisBint我總共有20條記錄來獲取天氣,所以我需要去20次URL調用嗎? – SigarDave

回答

0

的文檔建議你只能有在請求中定義的單個位置;

https://developer.worldweatheronline.com/api/docs/local-city-town-weather-api.aspx#qparameter

在此基礎上,你將需要提交您要檢查每個位置的請求。

+0

這是參數q對嗎?所以如果我把它作爲倫敦發送,印度會認爲它是倫敦的城市,印度的國家是正確的? – SigarDave

+0

是的,我會這麼說。 – ChrisBint

+0

好的,非常感謝克里斯我會試試這個,讓你知道並接受答案,然後 – SigarDave

相關問題