android - How to add variable to link -
i using retrofit library , weather forecast openweatherapi.
i have this.
base url: http://api.openweathermap.org/data/2.5/
@get("weather?q=&units=&appid=" + api_key) call<weatherapi> getweathercity(@query("city") string city, @query("units") string units);
but bad url (i not know how repair it) -
response{protocol=http/1.1, code=502, message=bad gateway, url=http://api.openweathermap.org/data/2.5/weather?q=&units=&appid=111111111111111111111111&city=&units=metric}
your problem in url. if break url down able see error.
so have main body of url:
http://api.openweathermap.org/data/2.5/weather
then first param
?q=
havent added after =, first problem.
then:
&units=
again nothing after =, next problem.
then:
&appid=111111111111111111111111
bit fine.
then:
&city=
again nothing after =.
then:
&units=metric
bit fine.
so problem not passing values parameters.
Comments
Post a Comment