protected String createApiGetUrl(final Map<String, String> params) {
		final StringBuilder result = new StringBuilder("http://").append(host).append('/').append(scriptPath);
		if (scriptPath.length() != 0) {
			result.append('/');
		}
		result.append("api.php?requestid=" + createRequestID());
		if (params != null) {
			for (final Map.Entry<String, String> param : params.entrySet()) {
				if (param.getValue() != null) {
					try {
						result.append('&').append(URLEncoder.encode(param.getKey(), "UTF-8")).append('=').append(URLEncoder.encode(param.getValue(), "UTF-8"));
					} catch (final UnsupportedEncodingException shouldNeverHappen) {
						throw new InternalError("UTF-8 is not supported by this Java VM");
					}
				}
			}
		}
		final Integer maxLag = getMaxLag();
		if (maxLag != null) {
			result.append("&maxlag=").append(maxLag);
		}
		return result.toString();
	}