Skip to content

GetTeamRatingInputByTeamId API

Overview

The GetTeamRatingInputByTeamId API retrieves the team rating input payload for a SuperCoach team. This builds the structured input required by the SuperCoach model's /RateTeam endpoint, combining roster data with player stats, prices, and selection status. This is a secure readmodel API that requires authentication.

Endpoint

POST /api/readmodel

Authentication

This API requires authentication. Users must have the Member role. Only the team owner or an Admin can access a given team's rating input.

Request Format

{
  "query": {
    "queryType": "GetTeamRatingInputByTeamId",
    "id": "supercoach-team-guid",
    "season": "2026"
  },
  "dataType": "TeamRatingInput"
}

Query Parameters

Parameter Type Required Description
queryType string Yes Must be "GetTeamRatingInputByTeamId"
id GUID Yes The SuperCoach team ID
season string No Season year filter (defaults to "2026")

Response Format

{
  "results": [
    {
      "team": {
        "fox-player-id-1": {
          "rating": 75.5,
          "breakdown": null,
          "price": 450000,
          "selectionStatus": 0,
          "superCoachPositions": []
        },
        "fox-player-id-2": {
          "rating": 62.3,
          "breakdown": null,
          "price": 320000,
          "selectionStatus": 2,
          "superCoachPositions": []
        }
      },
      "round": 1,
      "finalRound": 27
    }
  ],
  "totalCount": 1,
  "requestId": "guid-here"
}

Response Fields

Field Type Description
team Dictionary\<string, TeamRatingPlayerInput> Map of FoxSports player IDs to their rating input data
round int Current round (defaults to 1)
finalRound int Final round of the season (defaults to 27)

TeamRatingPlayerInput Fields

Field Type Description
rating double? Player's current SuperCoach rating
breakdown Dictionary\<int, PlayerRatingBreakdown>? Per-round breakdown of projected points and price delta
price int Player's current SuperCoach price
selectionStatus int Roster selection status: 0=Captain, 1=ViceCaptain, 2=Selected, 3=Reserve, 4=Bench
superCoachPositions int[] Player's eligible SuperCoach positions

Example Usage

Get team rating input for a specific team

curl -X POST "https://api.ballr.live/api/readmodel" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "query": {
      "queryType": "GetTeamRatingInputByTeamId",
      "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
    },
    "dataType": "TeamRatingInput"
  }'

Get team rating input for a specific season

curl -X POST "https://api.ballr.live/api/readmodel" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "query": {
      "queryType": "GetTeamRatingInputByTeamId",
      "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "season": "2025"
    },
    "dataType": "TeamRatingInput"
  }'

Error Responses

400 Bad Request

{
  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
  "title": "One or more validation errors occurred.",
  "status": 400,
  "errors": {
    "Id": ["Id is required"]
  }
}

401 Unauthorized

{
  "type": "https://tools.ietf.org/html/rfc7235#section-3.1",
  "title": "Unauthorized",
  "status": 401
}

404 Not Found

Returns empty results if the team does not exist or the authenticated user does not own the team.

{
  "results": [],
  "totalCount": 0
}

500 Internal Server Error

{
  "type": "https://tools.ietf.org/html/rfc7231#section-6.6.1",
  "title": "An error occurred while processing your request.",
  "status": 500
}

Notes

  • This API requires authentication with the Member role - unauthenticated requests will return 401
  • Access is restricted to the team owner or users with the Admin role; unauthorized access returns empty results
  • The handler loads the team directly via session.LoadAsync<SupercoachTeamContract> (it does not call another query handler), then enriches the roster with player stats from the Foundry store
  • Player IDs are mapped from roster participant IDs to FoxSports source IDs via IMappedPlayersProvider, resolved through the GetParticipantStatsAsync helper
  • Players without a matching stats record or participant mapping are excluded from the output
  • The selectionStatus integer maps to roster positions: 0=Captain, 1=ViceCaptain, 2=Selected, 3=Reserve, 4=Bench
  • The response payload is designed to be passed directly to the SuperCoach model API's /RateTeam endpoint