title: how to ewquest Delete method with json body in Jersey client
body: <p>I am writing a test program to test the jersey client to have  json body in it. I am getting the response with postman and trying to call it from java jersey client but getting error as </p>
  
  <pre><code>java.lang.IllegalStateException: Entity must be null for http method DELETE.
  </code></pre>
  
  <p>How can I request delete endpoint with json body in jersey.</p>
  
  <p>I tried the following client:</p>
  
  <pre><code>import javax.ws.rs.client.*;
  import javax.ws.rs.core.MediaType;
  import javax.ws.rs.core.MultivaluedHashMap;
  import javax.ws.rs.core.MultivaluedMap;
  import javax.ws.rs.core.Response;
  
  
  public class First {
      public static void main(String[] args) {
          String str = "{\n" +
                  "\t\"ecid\": \"1\",\n" +
                  "\t\"customerModelKey\": \"195000300\",\n" +
                  "\t\"customerModelName\": \"A\",\n" +
                  "\t\"customerGroupCode\": \"BI\"\n" +
                  "}";
          System.out.println("test");
          Client client = ClientBuilder.newClient();
          WebTarget webTarget
                  = client.target("http://localhost:9092/");
          WebTarget employeeWebTarget
                  = webTarget.path("deletemodelecidrel");
          Invocation.Builder invocationBuilder
                  = employeeWebTarget.request(MediaType.APPLICATION_JSON);
         Invocation invocation
                  = invocationBuilder.build("DELETE",Entity.text(str));
  
         Response response = invocation.invoke();
          System.out.println(response);
      }
  }
  </code></pre>