public String sendPostRequest(@NotNull String url, @NotNull final byte[] requestData)
      throws IOException, CopyExceptionWithFailureReason {

    final String appleRequestUUID = UUID.randomUUID().toString();
    final UUID jobId = JobMetadata.getJobId();
    monitor.info(
      () -> "POST Request from AppleMediaInterface",
      Headers.CORRELATION_ID, appleRequestUUID,
      AuditKeys.uri, url,
      AuditKeys.jobId, jobId.toString());

    HttpURLConnection con = null;
    String responseString = "";
    try {
      URL applePhotosUrl = new URL(url);
      con = (HttpURLConnection) applePhotosUrl.openConnection();
      con.setDoOutput(true);
      con.setRequestMethod("POST");
      con.setRequestProperty(Headers.AUTHORIZATION.getValue(), authData.getAccessToken());
      con.setRequestProperty(Headers.CORRELATION_ID.getValue(), appleRequestUUID);
      if (url.contains(baseUrl)) {
        // which means we are not sending request to get access token, the
        // contentStream is not filled with params, but with DTP transfer request
        con.setRequestProperty(Headers.CONTENT_TYPE.getValue(), "");
      }
      IOUtils.write(requestData, con.getOutputStream());
      responseString = IOUtils.toString(con.getInputStream(), StandardCharsets.ISO_8859_1);

    } catch (IOException e) {
      monitor.severe(
        () -> "Exception from POST in AppleMediaInterface",
        Headers.CORRELATION_ID.getValue(), appleRequestUUID,
        AuditKeys.jobId, jobId.toString(),
        AuditKeys.error, e.getMessage(),
        AuditKeys.errorCode, con.getResponseCode(),
      e);

      convertAndThrowException(e, con);
    } finally {
      con.disconnect();
    }
    return responseString;
  }
An interface that is synonymous to HTTP client to interact with the Apple Photos APIs.
extensions/data-transfer/portability-data-transfer-apple/src/main/java/org/datatransferproject/datatransfer/apple/photos/AppleMediaInterface.java