-2

My URL is like -

https://api.insideview.com/api/v1/people/abcdef?active=true

here the arguments passed are people=abcdef and active=true

How can I incorporate both the parameters using get method-

My code is like-

public PeopleDetailInstance peopledetail(String peopleId) {
        HttpClient client = new HttpClient();
        GetMethod method = new GetMethod("https://api.insideview.com/api/v1/people/"+peopleId); 
snigdha
  • 57
  • 7
  • Possible duplicate of [How do I add query parameters to a GetMethod (using Java commons-httpclient)?](http://stackoverflow.com/questions/217070/how-do-i-add-query-parameters-to-a-getmethod-using-java-commons-httpclient) – Ricardo Pontual Oct 26 '16 at 10:22
  • refer this ur problem may solve http://stackoverflow.com/questions/19891494/how-to-pass-receive-multiple-args-to-a-restful-web-api-get-method – Hema Oct 26 '16 at 10:25
  • In your case url should be like this https://api.insideview.com/api/v1?active=true&people=abcdef – Rissmon Suresh Oct 26 '16 at 10:26
  • https://api.insideview.com/api/v1?people=abcdef&active=true – Keval Pithva Oct 26 '16 at 11:20

3 Answers3

1
... peopledetail(String peopleId, Boolean active) {
        HttpClient client = new HttpClient();
        GetMethod method = new GetMethod("https://api.insideview.com/api/v1/people/"+peopleId + "&active=" + active)

Edit - sorry by the bad format. Im in phone.

Kalana
  • 5,631
  • 7
  • 30
  • 51
Anderson Oki
  • 637
  • 1
  • 6
  • 18
0

Now sure where your api url ends but query string should be
your url + ?parameter1="value"&parameter2="value"
https://yourApiUrl?people=peopleId&active=true

Bglen
  • 59
  • 10
0

Try this

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);
}