title: Docker Image and Java HTTP Post Request
body: <p>I have a task to ping and endpoint using a post request. The issue I am having is the full endpoint is not clearly defined. I have a docker image and container but I am not sure how to use it in order to make a successful api call.</p>
  <pre><code>CloseableHttpClient client = HttpClients.createDefault();
  HttpPost httpPost = new HttpPost(&quot;/auth&quot;);
  
  //Auth object just has 1 field called account
  Auth a = new Auth(&quot;Test-acc&quot;);
  Gson gson= new Gson();
  String json =  gson.toJson(a);
  System.out.println(&quot;Json: &quot; + json);
  
      
  StringEntity entity = new StringEntity(json);
  httpPost.setEntity(entity);
  httpPost.setHeader(&quot;Accept&quot;, &quot;application/json&quot;);
  httpPost.setHeader(&quot;Content-type&quot;, &quot;application/json&quot;); 
  httpPost.setHeader(&quot;Api-Key&quot;, &quot;API Key is given for Test-acc&quot;); 
  
  CloseableHttpResponse response = client.execute(httpPost); //error as unknown endpoint?
  client.close();
  //read response
  HttpEntity res =  response.getEntity();
  String result = EntityUtils.toString(res);
  </code></pre>
  <p>The error I get is: client.ClientProtocolException. The endpoint /auth gives me back a session token but I am unsure how to call the full endpoint (e.g. https://.../auth). I assume it has something to do with the docker container that is provided.</p>
  <p>To test that the container is running I run docker run and get the response {&quot;message&quot;: &quot;ok&quot;}. But other than that, I am unsure how to use it. Will the image in the container help with this?</p>
  <p>Docker run command:</p>
  <pre><code>docker run -p 7902:7902 tesingCompany/testprovider
  </code></pre>