$tmp["name"] = $sportType["name"]; array_push($response["sportTypes"], $tmp); } echoRespnse(200, $response); }); /** * Listing single task of particual user * method GET * url /tasks/:id * Will return 404 if the task doesn't belongs to user */ $app->get('/sportType/:id', 'authenticate', function ($id) { $response = array(); $db = new DbHandler(); // fetch task $result = $db->getSportType($id); if ($result != NULL) { $response["error"] = false; $response["id"] = $result["id"]; $response["name"] = $result["name"]; echoRespnse(200, $response); } else { $response["error"] = true; $response["message"] = "Sport type with id " . $id . " was NOT found."; echoRespnse(404, $response); } }); /** * Updating existing task * method PUT * params task, status