title: Adding header authorisation with Jersey
body: <p>I have made a simple api, I know that it is working as I have tested it with PostMan. I would like to consume this in a standalone Java application. One solution I have found is to use Jersey. For my purposes I just need to do a get request. Here is what I have so far but I am just getting 404 Bad request:</p>
  
  <pre><code>package apitest;
  
  import javax.ws.rs.client.Client;
  import javax.ws.rs.client.ClientBuilder;
  import javax.ws.rs.client.WebTarget;
  import javax.ws.rs.core.MediaType;
  
  public class Apitest {
  
      public static void main(String[] args) {
  
      Client client = ClientBuilder.newClient();
  
      WebTarget target=client.target("http://188.166.152.46/task_manager/v1/tasks");
  
      System.out.println(target.request(MediaType.APPLICATION_JSON).get(String.class));
  
      }
  
  }
  </code></pre>
  
  <p>This shouldn't work as I also need to add authorisation in the header. I would expect it to return "API key missing" though. </p>
  
  <p>Can you see what I have done wrong? The test api is up and running. Also, how would I add the authorisation in the header? If not Jersey, do you know of anything else that would be suitable and easy to use with documentation that even an idiot could follow?</p>