ALM API 401 error

I wrote java code to get authentication cookie, but when I send it to API defect service, I get 401 error.  I believe that is a user not authenticated error.  What else should I send with it?

URL defectURL= new URL("">blah/.../3");
HttpURLConnection defectConnection = (HttpURLConnection) defectURL.openConnection();

defectConnection.setRequestMethod("GET");

String concatenatedCookieString = "QCSession=" + QCSession_Cookie + ";" + "ALM_USER=" + ALM_USER_Cookie + ";" + "XSRF-TOKEN=" + XSRFToken + ";"+ "LWSSO_COOKIE_KEY=" + authenticationCookie;
defectConnection.setRequestProperty("Cookie", concatenatedCookieString);
defectConnection.setRequestProperty("Content-Type", "application/json");
BufferedReader defectReader = new BufferedReader(new InputStreamReader(defectConnection.getInputStream()));

We are still on ALM 15.5.