/// <summary>
        /// Issue an HTTP POST request with the given <c>postRequest</c> to the specified 
        /// API <c>method</c>.
        /// </summary>
        /// <param name="method">The API method to issue the POST request to.</param>
        /// <param name="postRequest">The POST request body to send to the API.</param>
        /// <param name="boundary">Field string separating different fields in the POST message.
        /// This is required to send the correct content-type header in the request.</param>
        /// <returns>The JSON response returned by the API.</returns>
        /// <exception cref="ArgumentNullException">If method is Nothing.</exception>
        /// <exception cref="HttpUtilsException">If an error occurs making or issuing the HTTP POST
        /// request to the API.</exception>
        /// <exception cref="Newtonsoft.Json.JsonReaderException">If an error occurs parsing the 
        /// API response to JSON.</exception>
        protected JObject PostApiRequest(string method, byte[] postRequest, string boundary)
        {
            HttpUtils httpHelper = new HttpUtils(this.username, this.password);

            if (method == null)
            {
                if (log.IsErrorEnabled)
                    log.Error("POST request to API failed: 'method' is null");
                throw new ArgumentNullException("method is null");
            }

            string requestURL = apiURL + method + "/";

            try
            {
                string response = httpHelper.Post(requestURL, postRequest, boundary);
                return JObject.Parse(response);
            }
            catch (HttpUtilsException hue)
            {
                if (log.IsErrorEnabled)
                    log.Error("GET request to API failed", hue);
                throw hue;
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                    log.Error("failed to parse POST API response", e);
                throw new Newtonsoft.Json.JsonReaderException("failed to parse POST API response", e);
            }
        }
        /// <summary>
        /// Issue an HTTP GET request to the specified API <c>method</c> with the 
        /// given API method <c>queryParams</c>.
        /// </summary>
        /// <param name="method">The API method to issue the HTTP GET request to.</param>
        /// <param name="queryParams">List of name=value query parameters to include in the
        /// API method call. Pairs must be separated by ampersands.</param>
        /// <returns>The JSON response returned by the API.</returns>
        /// <exception cref="ArgumentNullException">If method is Nothing.</exception>
        /// <exception cref="HttpUtilsException">If an error occurs making or issuing the HTTP GET
        /// request to the API.</exception>
        /// <exception cref="Newtonsoft.Json.JsonReaderException">If an error occurs parsing the 
        /// API response to JSON.</exception>
        protected JObject GetApiRequest(string method, string queryParams)
        {
            if (method == null)
            {
                if (log.IsErrorEnabled)
                    log.Error("GET request to API failed: 'method' is null");
                throw new ArgumentNullException("method is null");
            }

            HttpUtils httpHelper = new HttpUtils(this.username, this.password);
            string requestURL = apiURL + method + "/";

            if (queryParams != null)
            {
                requestURL += "?" + queryParams;
            }

            try
            {
                string jsonResponse = httpHelper.Get(requestURL);
                return JObject.Parse(jsonResponse);
            }
            catch (HttpUtilsException hue)
            {
                if (log.IsErrorEnabled)
                    log.Error("GET request to API failed", hue);
                throw hue;
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                    log.Error("failed to parse GET API response", e);
                throw new Newtonsoft.Json.JsonReaderException("failed to parse GET API response", e);
            }
        }