getQueryParam('url'); if (isset($url)) { try { $this->video = new Video($url, $this->getFormat($request), $this->getPassword($request)); return $response->withJson($this->video->getJson()); } catch (Exception $e) { return $response->withJson(['error' => $e->getMessage()]) ->withStatus(500); } } else { return $response->withJson(['error' => 'You need to provide the url parameter']) ->withStatus(400); } } }