public InputStream sendRequest(String requestMethod,
			Map<String, String> parameters) throws IOException {
		String queryString = getQueryString(parameters);
		URL url = new URL(this.apiBaseUrl);
		HttpURLConnection connection = (HttpURLConnection) WebResourceFetcherImpl
				.getUrlConnection(url);

		setupConnection(requestMethod, queryString, connection);
		OutputStreamWriter writer = new OutputStreamWriter(
				connection.getOutputStream());
		writer.write(queryString);
		writer.flush();
		writer.close();

		int rc = connection.getResponseCode();
		if (rc != 200) {
			logger.warn("Error: API request returned response code " + rc);
		}

		InputStream iStream = connection.getInputStream();
		fillCookies(connection.getHeaderFields());
		return iStream;
	}
public InputStream sendRequest ( String requestMethod , Map < String , String > parameters ) throws IOException { String queryString = getQueryString ( parameters ) ; URL url = new URL ( this . apiBaseUrl ) ; HttpURLConnection connection = ( HttpURLConnection ) WebResourceFetcherImpl . getUrlConnection ( url ) ; setupConnection ( requestMethod , queryString , connection ) ; OutputStreamWriter writer = new OutputStreamWriter ( connection . getOutputStream ( ) ) ; writer . write ( queryString ) ; writer . flush ( ) ; writer . close ( ) ; int rc = connection . getResponseCode ( ) ; if ( rc != 200 ) { logger . warn ( "Error: API request returned response code " + rc ) ; } InputStream iStream = connection . getInputStream ( ) ; fillCookies ( connection . getHeaderFields ( ) ) ; return iStream ; }
Sends a request to the API with the given parameters and the given
request method and returns the result string. It automatically fills the
cookie map with cookies in the result header after the request.

Warning: You probably want to use ApiConnection.sendJsonRequest
that execute the request using JSON content format,
throws the errors and logs the warnings.

@param requestMethod
either POST or GET
@param parameters
Maps parameter keys to values. Out of this map the function
will create a query string for the request.
@return API result
@throws IOException