Executes the api call with the provided information.
@param httpMethod The http method.
@param urlSuffix The url suffix.
@param options The options object.
@param errorMessage The error message.
@return {Promise} The promise.
@private
435776
function _execute(httpMethod, urlSuffix, options, errorMessage) {
        const opts = {
            headers: {
                'Content-Type': 'application/json',
                'ngapimockid': ngapimockid
            }
        };

        if (options !== undefined) {
            opts.json = options;
        }

        return _handleRequest(httpMethod, urlSuffix, opts, errorMessage);
    }
952364
public static void callMethod(final Object obj, final String methodName, final Object... args) {
		try {
			callMethod(obj, methodName, false, args);
		} catch (InvocationTargetException e) {
			JK.throww(e);
		}
	}
275544
function execHttp(options, callback) {

      if (proxyList) {
        options.proxy  = proxyList.getProxy().getUrl();
      }
      log.debug({"url" : options.url, "step" : "queue-requester.execHttp", "message" : "Execute the request"});
      request.get(options, function(error, result) {
        log.debug({"url" : options.url, "step" : "queue-requester.execHttp", "message" : "Execute the request done"});

        // TODO : review this solution/try to understand the origin of this problem
        // some sites provide inconsistent response for some urls (status 40* instead of 200).
        // In such case, it should be nice to retry (if the option retry400 == true)
        if (result.statusCode && result.statusCode >= 400 && result.statusCode <= 499 && result.retry400) {
           error = new Error("40* Error");
           error.code = result.statusCode;
        }

        if (error) {
          onRequestError(error, result, function(error){
            process.nextTick(function() {callback(error);});
          });
        }
        else {
          onCrawl(null, result, function(error){
            process.nextTick(function() {callback(error);});
          });
        }

      });


  }
977533
private <T> CompletionStage<T> executeRequest(HttpAsyncClient httpClient,
            HttpUriRequest httpRequest, JsonParser<T> parser) {
        CompletableFuture<T> future = new CompletableFuture<>();
        httpClient.execute(httpRequest, new FutureCallback<HttpResponse>() {
            @Override
            public void failed(Exception e) {
                future.completeExceptionally(e);
            }

            @Override
            public void completed(HttpResponse response) {
                int statusCode = response.getStatusLine().getStatusCode();
                if (statusCode == HttpStatus.SC_OK ||
                        statusCode == HttpStatus.SC_ACCEPTED) {

                    // Parse result type from the returned JSON
                    try {
                        T result = parser.parse(response.getEntity().getContent());
                        future.complete(result);
                    } catch (Exception e) {
                        future.completeExceptionally(e);
                    }
                } else {
                    future.completeExceptionally(createSaltException(statusCode));
                }
            }

            @Override
            public void cancelled() {
                future.cancel(false);
            }
        });

        return future;
    }
1332435
function jsonp(options, successCallback, errorCallback) {
    /*jshint camelcase:false */

    options = options || {};

    // Define unique callback name.
    var uniqueName = 'callback_json' + (++counter);

    // Send all data (including method, api key and data) via GET
    // request params.
    var params = options.params || {};
    params.callback = uniqueName;
    params.access_token = options.authorization;
    params.method = options.method || 'get';
    params.data = JSON.stringify(options.data);
    options.params = params;

    options.apiUrl = options.apiUrl && options.apiUrl.replace('//api', '//js-api');

    // Evrythng REST API default endpoint does not provide JSON-P
    // support, which '//js-api.evrythng.com' does.
    var url = Utils.buildUrl(options);

    // Return a promise and resolve/reject it in the callback function.
    return new Promise(function(resolve, reject) {

      // Attach callback as a global method. Evrythng's REST API error
      // responses always have a status and array of errors.
      window[uniqueName] = function(response){

        if (response.errors && response.status) {

          var errorData = _buildError(url, response.status, params.method, response);
          Logger.error(errorData);

          if(errorCallback) {
            Logger.warnCallbackDeprecation();
            errorCallback(errorData);
          }
          reject(errorData);

        }else {

          if(successCallback) {
            Logger.warnCallbackDeprecation();
            successCallback(response);
          }

          try {
            response = JSON.parse(response);
          } catch(e){}

          resolve(response);
        }

        // Remove callback from window.
        try {
          delete window[uniqueName];
        } catch (e) {}
        window[uniqueName] = null;
      };

      _load(url, reject);

    });
  }
1154328
protected <T> T performCustomRequest(String url, Object requestPayLoad, Class<T> returnType, Map<String, String> uriVariables,
                                       HttpMethod httpMethod, HttpHeaders headers) {

        if (headers == null) {
            headers = new HttpHeaders();
        }

        HttpEntity<Object> requestEntity = new HttpEntity<Object>(requestPayLoad, headers);

        int tryNumber = 1;
        while(tryNumber <= API_RETRY) {
            try {
                ResponseEntity<T> responseEntity = restTemplate.exchange(url, httpMethod, requestEntity, returnType, uriVariables);
                return responseEntity.getBody();
            } catch (HttpStatusCodeException error) {
                boolean isTooManyRequestsError = handleHttpStatusCodeError(uriVariables, tryNumber, error);
                if (isTooManyRequestsError) {
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        log.error("Error in performCustomRequest", e);
                    }
                } else {
                    tryNumber++;
                }
            } catch (RuntimeException e) {
                handleApiError(tryNumber, e);
                tryNumber++;
            }
        }

        throw new RestApiException("Error posting " + returnType.getSimpleName() + " url variables " + uriVariables.toString());
    }
764190
public void setHttpMessage(HttpMessage httpMessage) {
        this.httpMessage = httpMessage;
        setParamNames(httpMessage.getParamNames());
        this.alertUrl.setText(httpMessage.getRequestHeader().getURI().toString());
        this.historyRef = null;
    }
1307762
function makeRequest(options, callback) {
    request(options, function (error, response, body){
        if (error) {
            callback(error, null);
        }
        else if (response.statusCode == 200) {
            callback( null, JSON.parse(body));
        }
        else {
            callback(new Error('HTTP Response Code: ' + response.statusCode), null);
        }
    });
}
956873
@SuppressWarnings("unchecked")
	public <T> T call(String methodName, String restPath, Class<T> expectedResponse, Object payload,
			Map<String, String> queryParams) {
		WebTarget webTarget = createWebTarget(restPath, queryParams);
		Response result = webTarget.request().headers(headers).accept(mediaType.getMediaType()).method(
				methodName.toString(),
				Entity.entity(payload, mediaType.getMediaType()),
				Response.class);

		if (expectedResponse.getName().equals(Response.class.getName())) {
			return (T) result;
		}
		
		if (result != null && isStatusCodeOK(result, restPath)) {
			return (T) result.readEntity(expectedResponse);
		}

		throw new WebApplicationException("Unhandled response", result);
	}
607122
function trySendOptionsResponse(res, methods, next) {
  try {
    sendOptionsResponse(res, methods)
  } catch (err) {
    next(err)
  }
}
91481
function http(url, options) {
  return request(url, extend({}, this.options.http, options))
    .then(function(response) {
      if (!response.ok) throw response.status + '' + response.statusText;
      return response.text();
    });
}
905442
function doQuery(options) {
            return models.Webhook.getByEventAndTarget(options.data.webhooks[0].event, options.data.webhooks[0].target_url, _.omit(options, ['data']))
                .then((webhook) => {
                    if (webhook) {
                        return Promise.reject(new common.errors.ValidationError({message: common.i18n.t('errors.api.webhooks.webhookAlreadyExists')}));
                    }

                    return models.Webhook.add(options.data.webhooks[0], _.omit(options, ['data']));
                })
                .then((model) => {
                    return {
                        webhooks: [model.toJSON(options)]
                    };
                });
        }
2306
protected Operation httpOp(String method, HttpUrl url) {
        return new Operation(httpClient).method(method).httpUrl(url);
    }
593441
@Override
	public void execute(HttpGet httpGet, FutureCallback<HttpResponse> futureCallback) {

		try {
			if (httpGet == null) {
				throw new RuntimeException("Cannot issue GET request with HttpGet object");
			}
			log.info("Executing GET request to " + httpGet.getURI().toString());
			thread = new GetThread(client, httpGet, futureCallback);
			thread.start();
		} catch (Exception e) {
			log.error(e.getMessage());
			futureCallback.failed(e);
		}
	}
1275943
public String executePackageManagerMethodHtml(CloseableHttpClient httpClient, HttpRequestBase method) {
    PackageManagerHtmlCall call = new PackageManagerHtmlCall(httpClient, method, log);
    String message = executeHttpCallWithRetry(call, 0);
    return message;
  }
1100467
function (reqContext, name, args) {
    return BPromise.resolve()
        .bind(this)
        .then(function () {
            var method = this._methods[name];
            if (!method) {
                throw new MWError(404, "Method not found");
            }
            var context = R.merge(method.context, reqContext);
            return method.fn.apply(context, args);
        });
}
498520
def base_web_method_call( web_options, options ={}, url )
      options     = Smile::ParamConverter.clean_hash_keys( options )
      web_options = Smile::ParamConverter.clean_hash_keys( web_options )

      params = default_params.merge( web_options )
      params.merge!( options ) if( options )

      logger.info( params.inspect )

      json = RestClient.post( url, params ).body
      upper_hash_to_lower_hash( Smile::Json.parse( json ) )
		end