Player Info JSON Views
Player JSON view¶
The basic non-league dependent player api is the following
https://lm-api-reads.fantasy.espn.com/apis/v3/games/ffl/seasons/2023/players
with a GET parameter of players_wl. So the full request URL will look like
https://lm-api-reads.fantasy.espn.com/apis/v3/games/ffl/seasons/2023/players?view=players_wl
Player JSON view
As is, this is not particularly useful because this endpoint only returns players with last names starting from 'AA' to 'Al'. Not alot. This is where the Header x-fantasy-filter comes in handy.
Let's say we want the top 20 fantasy players for 2023 ranked by espn. We can do this by passing the value following value for the x-fantasy-filter header.
{"limit": 20, "sortDraftRanks": {"sortPriority": 100, "sortAsc": true, "value": "STANDARD"}}
Now we see Justin Jefferson as the first player in our array. What if we just want to see Ryan Tannehill's player info? We can pass this value {"filterIds":{"value":[14876]}} which includes his player id.
Player Pool Entry JSON view¶
This is great, but what we really need is to be able to pull any PlayerPoolEntry value that we would see in our mRoster. If you recall from the mRoster json view, a Team has a Roster object, with an array called entries of RosterEntry. Within the RosterEntry we have the PlayerPoolEntry which has information about the Player as it pertains to the specific league.
With that said we are going to use the same request URL as outlined in our first page but our view parameter is going to be kona_playercard. This is the view you see in the Network tab of the browser when you click on a player to see his fantasy points for the year and the current projection.
Info
Request URL is https://lm-api-reads.fantasy.espn.com/apis/v3/games/ffl/seasons/2023/segments/0/leagues/695660?view=kona_playercard and don't forget your Cookie header espnAuth={"swid":"{VALUE}"};espn_s2=VALUE;
This will an array of PlayerPoolEntry, with all the same information seen in mRoster.
kona_playercard JSON view
{
"players": [
{
"appliedStatTotal": 0.0,
"draftAuctionValue": 0,
"id": 2573401,
"keeperValue": 14,
"keeperValueFuture": 7,
"lineupLocked": false,
"onTeamId": 6,
"player": {
"active": true,
"defaultPositionId": 4,
"draftRanksByRankType": {
"STANDARD": {
"auctionValue": 1,
"rank": 168,
"rankSourceId": 0,
"rankType": "STANDARD",
"slotId": 0
},
"PPR": {
"auctionValue": 2,
"rank": 143,
"rankSourceId": 0,
"rankType": "PPR",
"slotId": 0
}
},
"droppable": true,
"eligibleSlots": [
5,
6,
23,
7,
20,
21
],
"firstName": "Tyler",
"fullName": "Tyler Higbee",
...
We can pass a similar x-fantasy-filter as before, but the value is slightly different, since we are targeting this players array. So if we want to see Ryan Tannehills PoolPlayerEntry with all the fantasy stats, we would use {"players":{"filterIds":{"value":[14876]}}} as the value for the x-fantasy-filter header.
Note
- The
x-fantasy-filterfor the non-league specific api is{"filterIds":{"value":[14876]}}
- The
x-fantasy-filterfor the league specifickona_player_cardjson view is{"players":{"filterIds":{"value":[14876]}}}
Tip
Just like for mRoster, you can set the scoringPeriodId as a GET parameter
so that you can see the players fantasy stats for a particular week or scoring period.