I found the API to get player data for my league. http://fantasy.espn.com/apis/v3/games/fba/seasons/2021/segments/0/leagues/?view=kona_player_info
However this only gets me the first 50 players. Does anyone know how I could get the rest? Is there some way to get them by last name letter?
Any help or tricks would be greatly appreciated.
They started using a custom request header x-fantasy-filter to give context to the results from API calls like: https://fantasy.espn.com/apis/v3/games/flb/seasons/2021/segments/0/leaguedefaults/1?scoringPeriodId=0&view=kona_player_info which is called from stat pages like https://fantasy.espn.com/baseball/players/projections.
Examine the header in your debugger and see if it looks similar to the one below.
Two obvious values are limit and offset. These are for pagination, give me 50 records, starting at the 50th record from the start gives you records 51-100.
It sounds like you might want to try out the sortDraftRanks to sort to specific records, but I haven't played with that yet.
{
"players":
{
"filterStatsForExternalIds": {"value":[2020,2021]},
"filterSlotIds":{"value":[0,1,2,3,4,5,6,7,8,9,10,11,12,19]},
"filterStatsForSourceIds":{"value":[0,1]},
"useFullProjectionTable":{"value":true},
"sortAppliedStatTotal":{"sortAsc":false,"sortPriority":2,"value":"102021"},
"sortDraftRanks":{"sortPriority":3,"sortAsc":true,"value":"STANDARD"},
"sortPercOwned":{"sortPriority":4,"sortAsc":false},
"limit":50,
"offset":50,
"filterStatsForTopScoringPeriodIds":{
"value":5,
"additionalValue":["002021","102021","002020","012021","022021","032021","042021","010002021"]
}
}
}