It works!
Turn off redirects:
client.setFollowRedirects(false);
and remove Expect
:
ClientResponse response = webResource
.header("X-API-Key", config.getKey())
.type("application/json")
.post(ClientResponse.class, json);
Cheers!