title: Pass variable in API url in java .
body: <p>I want to pass the <strong>"host name"</strong> , <strong>"port"</strong> , "<strong>cluster</strong>" in a particular API HTTP call. How to pass the variables in the url ?
  Any help is much appreciated .</p>
  
  <p><strong>Code :</strong> </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code> int port = Integer.parseInt(prop.getProperty("sd.port"));
   System.out.println("port no : " + port);
   String hostName = prop.getProperty("sd.hostname");
   System.out.println("host name : " + hostName);
   
   String cluster = app_prop.getProperty("ClusterName");
   System.out.println("cluster name is  : " + cluster);
   
   
   
   try {
  
    
   String url ="https://hostName:port/api/scanCluster?cid=cluster&amp;mode=1";</code></pre>
  </div>
  </div>
  </p>
  
  <p><strong>A seen in the above url , I am trying to pass "hostName" , "port" and "cluster" . Please help .</strong> </p>