Skip to content

Latest commit

 

History

History
75 lines (68 loc) · 2.43 KB

README.md

File metadata and controls

75 lines (68 loc) · 2.43 KB

API Documentation


Introduction


This API provides endpoints to retrieve information about the historic City-Poly game.

Endpoints


Get All Games

  • URL: /api/games
  • Method: GET
  • Description: Returns all games in JSON format.
  • Response:
    • Status Code: 200 OK
    • Body: JSON array of games.

Get Game by ID

  • URL: /api/games/:id
  • Method: GET
  • Description: Returns the game with the specified ID.
  • Parameters:
    • id (int): The ID of the game to retrieve.
  • Response:
    • Status Code:
      • 200 OK if the game is found.
      • 404 Not Found if the game with the specified ID is not found.
    • Body: JSON object representing the game.

Get Games by Home Team

  • URL: /api/games/home/:name
  • Method: GET
  • Description: Returns all games where the specified team plays as the home team.
  • Parameters:
    • name (string): Name of the home team to search for.
  • Response:
    • Status Code:
      • 200 OK if games involving the team are found.
      • 404 Not Found if no games involving the team are found.
    • Body: JSON array of games involving the specified team.

Get Games by Away Team

  • URL: /api/games/away/:name
  • Method: GET
  • Description: Returns all games where the specified team plays as the away team.
  • Parameters:
    • name (string): Name of the away team to search for.
  • Response:
    • Status Code:
      • 200 OK if games involving the team are found.
      • 404 Not Found if no games involving the team are found.
    • Body: JSON array of games involving the specified team.

Get Games by Year

  • URL: /api/games/year/:year
  • Method: GET
  • Description: Returns all games played in the specified year.
  • Parameters:
    • year (int): The year to retrieve games for.
  • Response:
    • Status Code:
      • 200 OK if games for the specified year are found.
      • 404 Not Found if no games are found for the specified year.
    • Body: JSON array of games played in the specified year.

Data Structure


Game

Represents a sports game.

  • ID (int): The unique identifier of the game.
  • HomeTeam (Team): The home team participating in the game.
  • AwayTeam (Team): The away team participating in the game.
  • Date (string): The date of the game in the format "YYYY-MM-DD".
  • Score (Score): The score of the game.
  • Notes (string): Additional notes about the game.