Skip to main content

2 posts tagged with "howto"

View All Tags

How It Works - AFLW in the API

ยท 2 min read
Nick Eggleton

The complete 2023 season of the NAB AFLW league is now available from the AFL API. This article describes how you can access AFLW 2023 matches and what API endpoints apply to them.

info

You must be licensed to access the AFLW league and its matches. If it isn't returned by the Leagues endpoint as described below, please contact Champion Data to check if you are correctly licensed.

AFLW Leagueโ€‹

The AFLW League has been assigned league Id 3, which you can see here when you call the Leagues endpoint.

Leagues

You can call every Season endpoint using league Id 3, they all support AFLW. Currently only the 2023 and (upcoming) 2024 seasons are available from the API, so you will receive a 404 error if you call on the prior seasons.

AFLW Matchesโ€‹

AFLW match data is accessed the same way as AFL Premiership matches; by looking up their match ids and calling the match endpoints.

As with the AFL Premiership, you can look up AFLW matches via the Season Fixture endpoint (enter league Id 3, level Id 1, season 2023) and get their match ids from there.

AFLW matches are supported by all the match endpoints, including the transactions endpoint if you are licensed to access it.

Sandbox AFLW Match Replayโ€‹

The Sandbox environment contains a replaying AFLW match, starting at the same times as the other matches. Note however, as AFLW match quarters are shorter than Premiership matches, the match status timing table doesn't completely align with the AFLW match.

Unsupported Metricsโ€‹

The following metrics do not support AFLW matches and are not returned via the match statistic endpoints.

GroupMetrics
Player Ratings
  • PLAYER_RATING
  • PLAYER_RATING_BALL_USE
  • PLAYER_RATING_BALL_USE_FIELD_KICK
  • PLAYER_RATING_BALL_USE_HANDBALL
  • PLAYER_RATING_BALL_USE_KICK_IN
  • PLAYER_RATING_BALL_USE_SHOT_AT_GOAL
  • PLAYER_RATING_BALL_WINNING
  • PLAYER_RATING_BALL_WINNING_INTERCEPT
  • PLAYER_RATING_BALL_WINNING_MID_CHAIN
  • PLAYER_RATING_BALL_WINNING_STOPPAGE
  • PLAYER_RATING_DEFENCE
  • PLAYER_RATING_DEFENCE_PRESSURE
  • PLAYER_RATING_DEFENCE_SPOIL
  • PLAYER_RATING_HITOUT
  • PLAYER_RATING_NEGATIVE
  • PLAYER_RATING_NEGATIVE_50M_PENALTY
  • PLAYER_RATING_NEGATIVE_DEBIT
  • PLAYER_RATING_NEGATIVE_FREE_KICK_AGAINST
Expected Score
  • POINTS_EXPECTED
  • SHOT_AT_GOAL_ACCURACY_EXPECTED
Time on Ground
  • TIME_ON_GROUND_DEFENCE
  • TIME_ON_GROUND_DEFENCE_PCT
  • TIME_ON_GROUND_FORWARD
  • TIME_ON_GROUND_FORWARD_PCT
  • TIME_ON_GROUND_MATCHUPS
  • TIME_ON_GROUND_MIDFIELD
  • TIME_ON_GROUND_MIDFIELD_PCT
  • TIME_ON_GROUND_ON_BALL
  • TIME_ON_GROUND_ON_BALL_PCT
  • TIME_ON_GROUND_RUCK
  • TIME_ON_GROUND_RUCK_PCT
  • TIME_ON_GROUND_WING
  • TIME_ON_GROUND_WING_PCT

How It Works - Last 5/10 Minutes

ยท 2 min read
Nick Eggleton

GET Endpointsโ€‹

The match stat GET endpoints now provides a new filter parameter called "lastXSeconds". This parameters filters the stats so they only count transactions that occurred on or within the last 'X' seconds of the match.

If used on a live match and called periodically, the stats will go up and down based on what's happened in the last number of seconds. As it is a 'seconds' filter, enter 300 to filter the last 5 minutes, 600 for last 10.

From and To Period Secondsโ€‹

Two more parameters have been added to the endpoints alongside lastXSeconds: fromPeriodSeconds and toPeriodSeconds.

These can be used to filter statistics to a particular range of time within a quarter. They can be used independently of each other, where they will run from the start/end of the quarter, or together to focus on a mid-quarter window.

note

These parameters aren't used in Last 5/10 Minutes filtering, and described here for completeness. Also note that you cannot use all three parameters at the same time - the API will return an error message stating this is the case.

POST Endpointsโ€‹

The match stat POST endpoints also support these parameters, they can be supplied in each metic request, and in different combinations in each request. They perform the same filtering as they do for the GET Endpoints.

R Package Support

The R package's getPlayerStats and getSquadStats function also include 'lastXSeconds' parameters to be used in the same fashion as calling the API endpoints directly. It too supports using the parameters in the getPlayerStatsPOST and getSquadStatsPOST endpoints. See here for more details.