[英]Receive specific data from a webservice using REST API
我想从以下API获取数据: http : //countryapi.gear.host/v1/Country/getCountries 。 我需要用户可以在JTextField
中输入Country
名称,并在JTextArea
获取NativeName
和CurrencyCode
。
我有这样的代码,它只返回我在HttpGet中编写的Country的数据: HttpGet request = new HttpGet("http://countryapi.gear.host/v1/Country/getCountries?pName=Australia");
。
但是我该怎么做,该用户可以编写国家/地区并获取所需的信息?
尝试使用这个
request = new HttpGet(
"http://countryapi.gear.host/v1/Country/getCountries?pName=country"
.replaceAll("country", yourTextField.getText())
);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.