addJsonValue("client_id", CLIENT_ID);
addJsonValues("events", Event.toObjectList(events));
// addJsonValue("events", )
- StringBuilder sb = new StringBuilder();
- sb.append(BASE_URL);
- sb.append('?');
- sb.append(buildQueryString());
+ StringBuilder urlSb = new StringBuilder();
+ urlSb.append(BASE_URL);
+ urlSb.append('?');
+ urlSb.append(buildQueryString());
try
{
- URL url = new URL(sb.toString());
+ URL url = new URL(urlSb.toString());
URLConnection urlConnection = url.openConnection();
HttpURLConnection httpURLConnection = (HttpURLConnection) urlConnection;
httpURLConnection.setRequestMethod("POST");
httpURLConnection.setDoOutput(true);
- byte[] jsonBytes = buildJson().getBytes(StandardCharsets.UTF_8);
+ String jsonString = buildJson();
+
+ Console.debug("##### HTTP Request is: '" + urlSb.toString() + "'");
+ Console.debug("##### POSTed JSON is:\n" + jsonString);
+
+ byte[] jsonBytes = jsonString.getBytes(StandardCharsets.UTF_8);
int jsonLength = jsonBytes.length;
httpURLConnection.setFixedLengthStreamingMode(jsonLength);