Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

class Client
{
const ACCEPT_VERSION = 'v0.1';

/**
* Blog Base Uri
* @var string
Expand Down Expand Up @@ -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/'
]);
}

Expand All @@ -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,
Expand Down Expand Up @@ -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);
Expand Down