Example #1
0
        echoRespnse(201, $response);
    } else {
        /* No scope so respond with 401 Unauthorized */
        echoRespnse(401, $response);
    }
});
/**
 * Gets the next soccer match of aparticular team
 * method GET
 * url /teams/:teamID/next-soccer-match
 */
$app->get('/teams/:teamID/next-soccer-match', function ($teamID) use($app) {
    $req = $app->request();
    $response = array();
    $db = new DbHandler();
    $result = $db->getTeamNextSoccerMatch($teamID);
    $nextSoccermatch = $result->fetch_assoc();
    $response["Error"] = false;
    $response["SoccerMatch"] = $nextSoccermatch;
    echoRespnse(200, $response);
});
/**
 * Gets the last soccer match result of aparticular team
 * method GET
 * url /teams/:teamID/last-result'
 */
$app->get('/teams/:teamID/last-result', function ($teamID) use($app) {
    $req = $app->request();
    $response = array();
    $db = new DbHandler();
    $result = $db->getTeamLastResult($teamID);