private function request($method, $url, array $parameters = [], array $headers = [])
    {
        $this->errors = null;

        // Set default content type
        $this->setHeader('Content-Type', 'application/json');

        $curl = curl_init();

        // Set options
        curl_setopt_array($curl, [
            CURLOPT_URL => "{$this->endpoint}{$url}",
            CURLOPT_CONNECTTIMEOUT => 10,
            CURLOPT_TIMEOUT => 90,
            CURLOPT_RETURNTRANSFER => 1,
            CURLOPT_SSL_VERIFYPEER => 0,
            CURLOPT_SSL_VERIFYHOST => 0,
            CURLOPT_HEADER => 1,
            CURLINFO_HEADER_OUT => 1,
            CURLOPT_VERBOSE => 1,
        ]);

        // Setup method specific options
        switch ($method) {
            case 'PUT':
            case 'PATCH':
            case 'POST':
                curl_setopt_array($curl, [
                    CURLOPT_CUSTOMREQUEST => $method,
                    CURLOPT_POST => true,
                    CURLOPT_POSTFIELDS => $this->buildArrayForCurl($parameters),
                ]);
                break;

            case 'DELETE':
                curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'DELETE');
                break;

            default:
                curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET');
                break;
        }

        // Set request headers
        curl_setopt($curl, CURLOPT_HTTPHEADER, array_filter(array_values($this->headers)));

        // Make request
        $response = curl_exec($curl);

        // Set HTTP response code
        $this->http_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);

        // Set errors if there are any
        if (curl_errno($curl)) {
            $this->errors = curl_error($curl);
        }

        // Parse body
        $header_size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
        $header = substr($response, 0, $header_size);
        $json = json_decode(substr($response, $header_size), false, 512, JSON_BIGINT_AS_STRING);

        // Check for errors
        $this->checkForCurlErrors($json);

        curl_close($curl);

        return $json;
    }