public static Map<String, String> requestDeletion(String urlString,
			String cookie) throws IOException {
		HttpURLConnection urlConnection = null;
		HashMap<String, String> result = new HashMap<String, String>();

		try {
			// open new URL connection channel.
			URL url = new URL(urlString);

			if ("https".equals(url.getProtocol().toLowerCase())) {
				trustAllHosts();
				HttpsURLConnection https = (HttpsURLConnection) url
						.openConnection();
				https.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
				urlConnection = https;
			} else {
				urlConnection = (HttpURLConnection) url.openConnection();
			}

			// some parameters
			urlConnection.setUseCaches(false);
			urlConnection.setInstanceFollowRedirects(false);

			// set cookie (if available)
			if (null != cookie) {
				urlConnection.setRequestProperty("x-session_id", cookie);
			}

			urlConnection.setDoOutput(false);
			urlConnection
					.setRequestProperty("Content-Type", "application/json");
			urlConnection.setRequestMethod("DELETE");

			// get response, or read error message
			InputStream inputStream;
			try {
				inputStream = urlConnection.getInputStream();
			} catch (IOException e) {
				inputStream = urlConnection.getErrorStream();
			}
			if (null == inputStream) {
				throw new IOException("could not get InputStream");
			}
			BufferedReader reader = new BufferedReader(new InputStreamReader(
					inputStream), 1024);
			String line;
			StringBuffer responseContent = new StringBuffer();
			while ((line = reader.readLine()) != null) {
				responseContent.append(line);
				responseContent.append('\r');
			}
			result.put("content", responseContent.toString());
			result.put("http response code",
					"" + urlConnection.getResponseCode());

			// clean up
			reader.close();
			reader = null;
			inputStream.close();
			inputStream = null;

			// get headers
			Map<String, List<String>> headerFields = urlConnection
					.getHeaderFields();
			String key, valueString;
			List<String> value;
			for (Entry<String, List<String>> entry : headerFields.entrySet()) {
				key = entry.getKey();
				value = entry.getValue();
				if (null != key && null != value) {
					key = key.toLowerCase();
					valueString = value.toString();
					valueString = valueString.substring(1,
							valueString.length() - 1);
					// Log.d(TAG, "Header field '" + key + "': '" + valueString
					// + "'");
					result.put(key, valueString);
				} else {
					// Log.d(TAG, "Skipped header field '" + key + "': '" +
					// value + "'");
				}
			}

			return result;

		} finally {
			if (urlConnection != null) {
				urlConnection.disconnect();
			}
		}
	}