我的网址就像 -
https://api.insideview.com/api/v1/people/abcdef?active=true
这里传递的参数是people = abcdef和active = true
如何使用get方法 -
合并这两个参数我的代码就像 -
public PeopleDetailInstance peopledetail(String peopleId) {
HttpClient client = new HttpClient();
GetMethod method = new GetMethod("https://api.insideview.com/api/v1/people/"+peopleId);
答案 0 :(得分:1)
... peopledetail(String peopleId,Boolean active){ HttpClient client = new HttpClient(); GetMethod方法=新的GetMethod(" https://api.insideview.com/api/v1/people/" + peopleId +"& active =" + active)
编辑 - 抱歉格式不正确。我在电话里。
答案 1 :(得分:0)
现在确定你的api url结束但查询字符串应该是
你的网址+?parameter1 =“value”& parameter2 =“value”
https://yourApiUrl?people=peopleId&active=true
答案 2 :(得分:0)
试试这个
public PeopleDetailInstance peopledetail(String peopleId) {
URIBuilder builder = new URIBuilder();
builder.setScheme("https")
.setHost("api.insideview.com")
.setPath("/api/v1")
.setParameter("people", peopleId)
.setParameter("active", "true")
URI uri = builder.build();
HttpGet httpget = new HttpGet(uri);
}