In this exercise, you'll see how to pull data from an API and display it nicely formatted in a web page. We'll get data from mlb.com API on the Houston Astro baseball player Alex Bregman. Pick your own player if you want.
You now have a baseball card that shows basic data about the player such as birth date, team, height, and so on. Next is to pull data from the API using a different request.
Height | height_inches |
Height | height_feet |
Weight | weight |
Position | position |
Hitting | bats |
Throwing | throws |
Birth date | birth_date |
Team | team_full |
MLB debut | pro_debut_date |
Home runs | hr |
RBIs | rbi |
Average | avg |
Slugging | slg |
OBP | obp |
Walks | bb |
Hits | h |
At bats | ab |
Strikeouts | so |
Doubles | d |
Triples | t |
At bats | ab |
Return to the main index.
Baseball Abbreviations Glossary
sportradar. Another API baseball source
JSON Pretty Print
MLB Data API. API used here.