Search code examples
jsonapirestespn

Does ESPN's API return images


Does the ESPN API return links to player images for any sport? I need to show the player images along with the other data I am successfully able to retrieve. If not is there another recommended way to retrieve these images?


Solution

  • I actually had no idea ESPN had an API. That's awesome.

    From the documentation, it looks like you can find images through the headshots property in the response (if available):

    headshots   Collection of athlete headshots as specified below, each containing href, width, and height attributes. Soccer, recruiting, and WNBA not currently supported. Note: clients apps must be responsible for handling missing headshots as not every athlete has one.               
    full 600x436 athlete headshot               
    xlarge 350x254 athlete headshot             
    large 65x90 athlete headshot                
    medium 43x60 athlete headshot               
    small 34x48 athlete headshot                
    xsmall 28x38 athlete headshot               
    fantasy 200x145 athlete headshot
    

    There is also a Video API, but it doesn't look like it's keyed on athlete.