Skip to content

Commit

Permalink
Issue #255 Request zone filtered by zone name for api token support
Browse files Browse the repository at this point in the history
  • Loading branch information
manatarms committed Sep 23, 2020
1 parent 40b457f commit 046dba8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/WordPress/ClientActions.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ public function returnWordPressDomain()
// Call GET /zones
$response = $this->api->callAPI($this->request);

// We tried to fetch a zone but it's possible we're using an API token,
// So try again with a zone name filterd API call
if (!$this->api->responseOk($response)) {
$zoneRequest = new Request('GET', 'zones/', array('name' => $this->wordpressAPI->getOriginalDomain()), array());
$zoneResponse = $this->api->callAPI($zoneRequest);

return $zoneResponse;
}

// Cache the domain for subdomains
$this->cacheDomainName($response);

Expand Down

0 comments on commit 046dba8

Please sign in to comment.