javarestapache-httpcomponents

Apache HttpComponents URIBuilder rest with multivalue params


I am trying to send a GET request to an endpoint similar to this:

  http://{hostname}api/search/artifact?name=junit&repos=snapshot,deploy,release

I have a parameter (repos) with comma separated values. I am looking a way to send this request with URIBuilder of Apache HttpComponents. I have tried constructing NameValuePair ( same name[repos] but different values), but this is format is not valid for the api. Can anybody help?


Solution

  • Why not combine the multiple value yourself into a single value "snapshot,deploy,release".

    String.join(",", reposList);