From 046dba8122f0a81062b45e10fd6624a284021a14 Mon Sep 17 00:00:00 2001 From: Sachin Fernandes Date: Wed, 23 Sep 2020 16:46:43 -0700 Subject: [PATCH] Issue #255 Request zone filtered by zone name for api token support --- src/WordPress/ClientActions.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/WordPress/ClientActions.php b/src/WordPress/ClientActions.php index fc62daed..d6475c24 100644 --- a/src/WordPress/ClientActions.php +++ b/src/WordPress/ClientActions.php @@ -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);