diff --git a/src/Client.php b/src/Client.php index 4675dbe..f091da2 100644 --- a/src/Client.php +++ b/src/Client.php @@ -4,6 +4,8 @@ class Client { + const ACCEPT_VERSION = 'v0.1'; + /** * Blog Base Uri * @var string @@ -68,7 +70,7 @@ public function initializeHTTPClient() { // Initialize the guzzle client $this->httpClient = new \GuzzleHttp\Client([ - 'base_uri' => $this->baseUri . '/ghost/api/v0.1/' + 'base_uri' => $this->baseUri . '/ghost/api/' ]); } @@ -89,6 +91,9 @@ public function isAuthenticated() protected function authenticate() { $response = $this->httpClient->request('POST', 'authentication/token', [ + 'headers' => [ + 'Accept-Version' => self::ACCEPT_VERSION, + ], 'form_params' => [ 'grant_type' => 'password', 'username' => $this->username, @@ -125,6 +130,7 @@ public function request($method, $route, $options) // Here we prepare the guzzle request $options['headers']['Authorization'] = 'Bearer ' . $this->getToken(); $options['headers']['Content-Type'] = 'application/json'; + $options['headers']['Accept-Version'] = self::ACCEPT_VERSION; // Do a guzzle request return $this->httpClient->request($method, $route, $options);