public function getApiRequest($apiUrl, $deferred)
    {
        return new Request([
            'url' => $apiUrl,
            'resolveCallback' =>
                function (Response $response) use ($deferred) {
                    $data = (string) $response->getBody();
                    $headers = $response->getHeaders();
                    $code = $response->getStatusCode();
                    $shortUrl = $this->handleResponse($data, $headers, $code);
                    if ($shortUrl === false) {
                        $deferred->reject();
                    } else {
                        $deferred->resolve($shortUrl);
                    }
                },
            'rejectCallback' => [$deferred, 'reject']
        ]);
    }