Fantasy Premier League (FPL) Coach

Fantasy Premier League (FPL) Coach · GPT アクション

Fantasy Premier League API

API for accessing Fantasy Premier League fixture data

  • GET /manager/{manager_id}Get Manager Details

    Retrieve details of a fantasy league manager by their ID.

  • GET /players_gameweek/{game_week}Get game week player live statistics

    Retrieve live statistics of players for a specific game week.

  • GET /fixturesGet fixture data

    Fixtures (past and future) are given in order, from gameweek 1 to 38. To get a specific gameweek, you can estimate the number of games in a gameweek, which is usually 10, then use the page and page_size parameters to retrieve the fixtures. eg, for gameweek 5, you would use page=1 and page_size=10.

  • GET /player/{player_id}Get detailed information about a specific player

    Retrieve in-depth information on a specific player, including past performance and upcoming fixtures. Player's ID is required, which can be obtained from other calls like bootstrap-static or /player/name/<player_name>

  • GET /player/name/{player_name}Get detailed information about a specific player

    Retrieve in-depth information on a specific player, including past performance and upcoming fixtures.

元の API スキーマ
openapi: 3.0.0
info:
  title: Fantasy Premier League API
  version: 1.0.0
  description: API for accessing Fantasy Premier League fixture data
servers:
  - url: https://n5hen7rw97.execute-api.us-east-1.amazonaws.com/prod/
    description: Production server
paths:
  /manager/{manager_id}:
    get:
      operationId: getManagerById
      summary: Get Manager Details
      description: Retrieve details of a fantasy league manager by their ID.
      parameters:
        - in: path
          name: manager_id
          required: true
          schema:
            type: integer
          description: The ID of the manager.
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ManagerResponse"
        "404":
          description: Manager not found
  /players_gameweek/{game_week}:
    get:
      operationId: getPlayerGameweek
      summary: Get game week player live statistics
      description: Retrieve live statistics of players for a specific game week.
      parameters:
        - name: game_week
          in: path
          required: true
          description: The game week number
          schema:
            type: integer
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GameWeekPlayerLiveResponse"
        "404":
          description: Game week not found

  /fixtures:
    get:
      operationId: getFixtures
      summary: Get fixture data
      description: Fixtures (past and future) are given in order, from gameweek 1 to 38. To get a specific gameweek, you can estimate the number of games in a gameweek, which is usually 10, then use the page and page_size parameters to retrieve the fixtures. eg, for gameweek 5, you would use page=1 and page_size=10.
      parameters:
        - in: query
          name: page
          required: false
          schema:
            type: integer
            default: 1
          description: Page number of the fixtures to retrieve.
        - in: query
          name: page_size
          required: false
          schema:
            type: integer
            default: 25
          description: Number of fixtures to retrieve per page.
      responses:
        "200":
          description: A list of fixtures
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/Event"

  /player/{player_id}:
    get:
      operationId: getPlayerById
      summary: Get detailed information about a specific player
      description: >
        Retrieve in-depth information on a specific player, including past performance and upcoming fixtures. 
        Player's ID is required, which can be obtained from other calls like bootstrap-static or /player/name/<player_name>
      parameters:
        - in: path
          name: player_id
          required: true
          schema:
            type: integer
          description: The unique identifier of the player
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PlayerElementResponse"
        "400":
          description: Bad request
        "404":
          description: Player not found
        "500":
          description: Server error

  /player/name/{player_name}:
    get:
      operationId: getPlayerByName
      summary: Get detailed information about a specific player
      description: >
        Retrieve in-depth information on a specific player, including past performance and upcoming fixtures.
      parameters:
        - in: path
          name: player_name
          required: true
          schema:
            type: string
          description: The name of the player
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PlayerElementResponse"
        "400":
          description: Bad request
        "404":
          description: Player not found
        "500":
          description: Server error

components:
  schemas:
    StatItem:
      type: object
      properties:
        value:
          type: integer
        element:
          type: integer
    Stat:
      type: object
      properties:
        identifier:
          type: string
        a:
          type: array
          items:
            $ref: "#/components/schemas/StatItem"
        h:
          type: array
          items:
            $ref: "#/components/schemas/StatItem"
    Event:
      type: object
      properties:
        code:
          type: integer
        event:
          type: integer
          nullable: true
        finished:
          type: boolean
        finished_provisional:
          type: boolean
        id:
          type: integer
        kickoff_time:
          type: string
          format: date-time
          nullable: true
        minutes:
          type: integer
        provisional_start_time:
          type: boolean
        started:
          type: boolean
          nullable: true
        team_a:
          type: integer
        team_a_score:
          type: integer
          nullable: true
        team_h:
          type: integer
        team_h_score:
          type: integer
          nullable: true
        stats:
          type: array
          items:
            $ref: "#/components/schemas/Stat"
        team_h_difficulty:
          type: integer
        team_a_difficulty:
          type: integer
        pulse_id:
          type: integer

    PlayerFixture:
      type: object
      properties:
        id:
          type: integer
        code:
          type: integer
        team_a:
          type: integer
        team_a_score:
          type: integer
          nullable: true
        team_h:
          type: integer
        team_h_score:
          type: integer
          nullable: true
        event:
          type: integer
        finished:
          type: boolean
        minutes:
          type: integer
        provisional_start_time:
          type: boolean
        kickoff_time:
          type: string
        event_name:
          type: string
        is_home:
          type: boolean
        difficulty:
          type: integer

    PlayerHistoricFixture:
      type: object
      properties:
        web_name:
          type: string
          nullable: true
        element:
          type: integer
        fixture:
          type: integer
        opponent_team:
          type: integer
        total_points:
          type: integer
        was_home:
          type: boolean
        kickoff_time:
          type: string
        team_h_score:
          type: integer
        team_a_score:
          type: integer
        round:
          type: integer
        minutes:
          type: integer
        goals_scored:
          type: integer
        assists:
          type: integer
        clean_sheets:
          type: integer
        goals_conceded:
          type: integer
        own_goals:
          type: integer
        penalties_saved:
          type: integer
        penalties_missed:
          type: integer
        yellow_cards:
          type: integer
        red_cards:
          type: integer
        saves:
          type: integer
        bonus:
          type: integer
        bps:
          type: integer
        influence:
          type: string
        creativity:
          type: string
        threat:
          type: string
        ict_index:
          type: string
        starts:
          type: integer
        expected_goals:
          type: number
        expected_assists:
          type: number
        expected_goal_involvements:
          type: number
        expected_goals_conceded:
          type: number
        value:
          type: integer
        transfers_balance:
          type: integer
        selected:
          type: integer
        transfers_in:
          type: integer
        transfers_out:
          type: integer

    PlayerHistoryPastSeasons:
      type: object
      properties:
        season_name:
          type: string
        element_code:
          type: integer
        start_cost:
          type: integer
        end_cost:
          type: integer
        total_points:
          type: integer
        minutes:
          type: integer
        goals_scored:
          type: integer
        assists:
          type: integer
        clean_sheets:
          type: integer
        goals_conceded:
          type: integer
        own_goals:
          type: integer
        penalties_saved:
          type: integer
        penalties_missed:
          type: integer
        yellow_cards:
          type: integer
        red_cards:
          type: integer
        saves:
          type: integer
        bonus:
          type: integer
        bps:
          type: integer
        influence:
          type: string
        creativity:
          type: string
        threat:
          type: string
        ict_index:
          type: string
        starts:
          type: integer
        expected_goals:
          type: number
        expected_assists:
          type: number
        expected_goal_involvements:
          type: number
        expected_goals_conceded:
          type: number

    PlayerElementResponse:
      type: object
      properties:
        web_name:
          type: string
        fixtures:
          type: array
          items:
            $ref: "#/components/schemas/PlayerFixture"
        history:
          type: array
          items:
            $ref: "#/components/schemas/PlayerHistoricFixture"
        history_past:
          type: array
          items:
            $ref: "#/components/schemas/PlayerHistoryPastSeasons"
      required:
        - fixtures
        - history
        - history_past

    # /players_gameweek/{game_week}
    ElementStats:
      type: object
      properties:
        minutes:
          type: integer
          nullable: true
        goals_scored:
          type: integer
          nullable: true
        assists:
          type: integer
          nullable: true
        clean_sheets:
          type: integer
          nullable: true
        goals_conceded:
          type: integer
          nullable: true
        own_goals:
          type: integer
          nullable: true
        penalties_saved:
          type: integer
          nullable: true
        penalties_missed:
          type: integer
          nullable: true
        yellow_cards:
          type: integer
          nullable: true
        red_cards:
          type: integer
          nullable: true
        saves:
          type: integer
          nullable: true
        bonus:
          type: integer
          nullable: true
        bps:
          type: integer
          nullable: true
        influence:
          type: string
          nullable: true
        creativity:
          type: string
          nullable: true
        threat:
          type: string
          nullable: true
        ict_index:
          type: string
          nullable: true
        starts:
          type: integer
          nullable: true
        expected_goals:
          type: number
          format: float
        expected_assists:
          type: number
          format: float
        expected_goal_involvements:
          type: number
          format: float
        expected_goals_conceded:
          type: number
          format: float
        total_points:
          type: integer
          nullable: true
        in_dreamteam:
          type: boolean
          nullable: true

    ExplainStats:
      type: object
      properties:
        identifier:
          type: string
          nullable: true
        points:
          type: integer
          nullable: true
        value:
          type: integer
          nullable: true

    Explain:
      type: object
      properties:
        fixture:
          type: integer
          nullable: true
        stats:
          type: array
          items:
            $ref: "#/components/schemas/ExplainStats"

    Element:
      type: object
      properties:
        id:
          type: integer
          nullable: true
        web_name:
          type: string
          nullable: true
        stats:
          $ref: "#/components/schemas/ElementStats"
        explain:
          type: array
          items:
            $ref: "#/components/schemas/Explain"

    GameWeekPlayerLiveResponse:
      type: object
      properties:
        elements:
          type: array
          items:
            $ref: "#/components/schemas/Element"

    # Manager types
    ClassicLeague:
      type: object
      properties:
        id:
          type: integer
          nullable: true
        name:
          type: string
          nullable: true
        short_name:
          type: string
          nullable: true
        created:
          type: string
          nullable: true
        closed:
          type: boolean
          nullable: true
        rank:
          type: integer
          nullable: true
        max_entries:
          type: integer
          nullable: true
        league_type:
          type: string
          nullable: true
        scoring:
          type: string
          nullable: true
        admin_entry:
          type: integer
          nullable: true
        start_event:
          type: integer
          nullable: true
        entry_can_leave:
          type: boolean
          nullable: true
        entry_can_admin:
          type: boolean
          nullable: true
        entry_can_invite:
          type: boolean
          nullable: true
        has_cup:
          type: boolean
          nullable: true
        cup_league:
          type: integer
          nullable: true
        cup_qualified:
          type: boolean
          nullable: true
        entry_rank:
          type: integer
          nullable: true
        entry_last_rank:
          type: integer
          nullable: true

    Leagues:
      type: object
      properties:
        classic:
          type: array
          items:
            $ref: "#/components/schemas/ClassicLeague"
        h2h:
          type: object
          nullable: true
        cup:
          type: object
          nullable: true
        cup_matches:
          type: array
          items:
            type: object
          nullable: true

    ManagerResponse:
      type: object
      properties:
        id:
          type: integer
          nullable: true
        joined_time:
          type: string
          nullable: true
        started_event:
          type: integer
          nullable: true
        favourite_team:
          type: integer
          nullable: true
        player_first_name:
          type: string
          nullable: true
        player_last_name:
          type: string
          nullable: true
        player_region_id:
          type: integer
          nullable: true
        player_region_name:
          type: string
          nullable: true
        player_region_iso_code_short:
          type: string
          nullable: true
        player_region_iso_code_long:
          type: string
          nullable: true
        summary_overall_points:
          type: integer
          nullable: true
        summary_overall_rank:
          type: integer
          nullable: true
        summary_event_points:
          type: integer
          nullable: true
        summary_event_rank:
          type: integer
          nullable: true
        current_event:
          type: integer
          nullable: true
        leagues:
          $ref: "#/components/schemas/Leagues"
        name:
          type: string
          nullable: true
        name_change_blocked:
          type: boolean
          nullable: true
        kit:
          type: string
          nullable: true
        last_deadline_bank:
          type: integer
          nullable: true
        last_deadline_value:
          type: integer
          nullable: true
        last_deadline_total_transfers:
          type: integer
          nullable: true