Make a get request to the given endpoint

@access public
@param  string   $endpoint
@param  array    $parameters
@return Response
19445
public function get($endpoint, array $parameters = array())
    {
        if (!empty($parameters)) {
            $path = sprintf("%s/?%s", $endpoint, http_build_query($parameters));
        } else {
            $path = $endpoint;
        }

        return $this->execute("GET", sprintf("%s%s", $this->host, $path));
    }
976815
public function makeRequest($method, $endpoint, array $data = [])
    {
        $response = $this->client->request($method, $endpoint, $data);

        return json_decode((string) $response->getBody());
    }
907306
private static function curl(string $endpoint)
    {
        // Get the base URL and App Key.
        $baseUrl = self::$_baseUrl;

        // Create a cURL session.
        $curl = curl_init();

        // Set the options necessary for communicating with the UCRM Server.
        curl_setopt($curl, CURLOPT_URL, $baseUrl.$endpoint);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_HEADER, false);

        // TODO: Determine if we EVER need to use HTTPS and how to handle it correctly here!
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2); // DEFAULT
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 1); // DEFAULT

        // Set the necessary HTTP HEADERS.
        curl_setopt($curl, CURLOPT_HTTPHEADER, self::$_headers);

        return $curl;
    }
762852
protected function getStream(string $endpoint, array $params)
    {
        $response = $this->requestRaw($endpoint, 'POST', ['json' => $params]);

        if (false !== stripos($response->getHeaderLine('Content-disposition'), 'attachment')) {
            return StreamResponse::buildFromPsrResponse($response);
        }

        return $this->castResponseToType($response, $this->app['config']->get('response_type'));
    }
78215
public function sendRequest($endpoint, array $parameters, IncomingMessage $matchingMessage)
    {
        $payload = array_merge_recursive([
            'to' => $matchingMessage->getSender(),
            'chatId' => $matchingMessage->getRecipient(),
        ], $parameters);

        return $this->sendPayload(['messages' => [$payload]]);
    }
849330
public function requestPost($endpoint, $params = array(), $headers = array())
    {
        return $this->getClient()->post($endpoint, $params, $headers);
    }
1013417
protected function buildUrl($endpoint, $params)
    {
        $url = $this->getOAuthApiRoot();
        $scheme = parse_url($url, PHP_URL_SCHEME);
        $authority = parse_url($url, PHP_URL_HOST);
        $path = parse_url($url, PHP_URL_PATH);
        $path .= trim($endpoint, '/');
        $fragment = '';
        $uri = Uri::composeComponents(
            $scheme,
            $authority,
            $path,
            build_query($params),
            $fragment
        );
        return $uri;
    }
913077
public function setEndpoint($endpoint = '')
    {
        $this->endpoint = $endpoint;
        $this->debug->info(__FUNCTION__, 'setEndpoint: ', $this->endpoint);

        return $this;
    }
590887
public function post($endpoint, array $parameters = array())
    {
        return $this->execute("POST", sprintf("%s%s", $this->host, $endpoint), $parameters);
    }
1324999
public function request($endpoint, $options = [], $body = '')
    {
        if ($this->getAcessToken()) {
            $options['authToken'] = $this->getAcessToken();
        }

        try {
            return $this->decodeResponse(parent::send($endpoint, $options, gzencode($body)));
        } catch(ClientException $e) {
            throw new EndomondoApiOldException($e->getMessage(), $e->getCode(), $e);
        }
    }
418212
private function request($method, $endpoint, $params, $body)
    {
        $setParams = $params && in_array($method, ["GET", "POST", "DELETE"]);
        $setBody = $body && in_array($method, ["POST", "PUT", "DELETE"]);

        $method = strtoupper($method);
        $url = $this->basePath . $endpoint . ($setParams ? "?" . $this->encodeParams($params) : "");

        $options = array();
        $options[CURLOPT_URL] = $url;
        $options[CURLOPT_HTTPHEADER] = $this->headers;
        $options[CURLOPT_RETURNTRANSFER] = true;
        $options[CURLOPT_CUSTOMREQUEST] = $method;
        $options[CURLOPT_POSTFIELDS] = $setBody ? json_encode($body) : null;
        $options[CURLOPT_CONNECTTIMEOUT] = $this->getConnectionOption("connectTimeout");
        $options[CURLOPT_TIMEOUT_MS] = $this->getConnectionOption("timeout");

        $curl = curl_init();

        if (isset($this->logger)) {
            $context = [ "options" => $options ];
            $this->logger->info("[ApiClient][Request] Curl request;", $context);
        }

        curl_setopt_array($curl, $options);

        $result = curl_exec($curl);
        $statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
        $error = curl_error($curl);

        curl_close($curl);

        if (isset($this->logger)) {
            $context = [ "result" => $result, "statusCode" => $statusCode, "error" => $error ];
            $this->logger->info("[ApiClient][Request] Curl response;", $context);
        }

        if ($result === false) {
            throw new ClientException($error);
        }
        elseif ($statusCode >= 400) {
            $error = json_decode($result);
            throw new ClientException($error, $statusCode);
        }

        return json_decode($result);
    }
375863
public function endpoint($endpoint = null)
    {
        if ($endpoint !== null) {
            $this->setName($endpoint);
        }

        return $this->getName();
    }
753543
public function endpoint(ApiEndpoint $endpoint)
    {
        $this->endpointsByName[$endpoint->getName()] = $endpoint;

        switch ($endpoint->getHttpMethod()) {

            case HttpMethods::GET:

                $this->get($endpoint->getPath(), $endpoint->getHandlerMethod(), $this->createRouteName($endpoint));
                break;

            case HttpMethods::POST:

                $this->post($endpoint->getPath(), $endpoint->getHandlerMethod(), $this->createRouteName($endpoint));
                break;

            case HttpMethods::PUT:

                $this->put($endpoint->getPath(), $endpoint->getHandlerMethod(), $this->createRouteName($endpoint));
                break;

            case HttpMethods::DELETE:

                $this->delete($endpoint->getPath(), $endpoint->getHandlerMethod(), $this->createRouteName($endpoint));
                break;
        }

        return $this;
    }
766877
public static function request($endpoint)
  {
    return (new Request(NULL, NULL, NULL))->host($endpoint)->get()->path('')->accept('application/json');
  }
860670
public function contentEndpointRequest(string $endpoint, array $arguments, $body = ''): ResponseInterface
    {
        $headers = ['Dropbox-API-Arg' => json_encode($arguments)];

        if ($body !== '') {
            $headers['Content-Type'] = 'application/octet-stream';
        }

        try {
            $response = $this->client->post($this->getEndpointUrl('content', $endpoint), [
                'headers' => $this->getHeaders($headers),
                'body' => $body,
            ]);
        } catch (ClientException $exception) {
            throw $this->determineException($exception);
        }

        return $response;
    }
235804
public function requestDelete($endpoint, $params = array(), $headers = array())
    {
        return $this->getClient()->delete($endpoint, $params, $headers);
    }
354092
public function request($endpoint, $verb = 'GET', $params = [], $data = null)
    {
        $context = $this->getStreamContext($verb);
        if ($data) {
            stream_context_set_option($context, array('http' => array('content' => json_encode($data))));
        }

        $query = http_build_query($params);
        $base = $this->getConfig()->getServer().$endpoint;
        $url = $base;

        if (!empty($query)) {
            $parsed = parse_url($base);
            if (key_exists('query', $parsed) || substr($base, -1) == "?") {
                $url .= '&'.$query;
            } else {
                $url .= '?'.$query;
            }
        }

        $handle = fopen($url, 'r', false, $context);
        if ($handle === false) {
            $e = error_get_last();
            throw new \Exception($e['message'], $e['type']);
        }
        $response = stream_get_contents($handle);
        fclose($handle);

        $response = json_decode($response, true);

        return $response;
    }