public function generatePdf(Template $template) { $guzzleclient = new GuzzleClient(); $res = $guzzleclient->post($this->url . '/api/v1', ['auth' => [$this->user, $this->password], 'headers' => ['content-type' => 'application/json'], 'body' => $template->serialize()]); if ($res->getStatusCode() == 201) { return json_decode($res->getBody(), true)['id']; } }