} else { /* No scope so respond with 401 Unauthorized */ echoRespnse(401, $response); } }); /** * Listing all players of a particular team in a particuar season * method GET * url /teams/:teamID/seasons/:seasonID/players */ $app->get('/teams/:teamID/seasons/:seasonID/players', function ($teamID, $seasonID) { global $user_id; $response = array(); $db = new DbHandler(); // fetching all players for the given team and season $result = $db->getPlayersByTeamAndSeason($teamID, $seasonID); $response["Error"] = false; $response["Players"] = array(); // looping through result and preparing player array while ($player = $result->fetch_assoc()) { array_push($response["Players"], $player); } echoRespnse(200, $response); }); /** * Lists the details of a particular player for a particular season * method GET * url /players/:playerID/seasons/:seasonID */ $app->get('/players/:playerID/seasons/:seasonID', function ($playerID, $seasonID) { global $user_id;