This open API can be used to retrieve details of MLB, such as the names of leagues, teams, and players. Additionally, it supports querying items grouped by specific criteria, like players grouped by team or teams grouped by leagues. It even allows for more advanced queries, such as filtering left or right-handed pitchers. For complete information, click on at link and review the swagger doc
You can access the list of players by using the /players endpoint.
[GET] https://fake-mlb-api.onrender.com/players
[
{
"bat": "R",
"id": 1,
"thw": "L","ht": "6\' 1\"",
"birth_place": "Riverton, UT",
"status": true,
"updated_at": "2023-12-06T15:29:53.009827",
"pos": "RP","name": "Tanner Banks",
"age": 32,
"wt": 210,
"created_at": "2023-12-06T15:29:53.009777",
"team_id": 1
} ,
//...
]
You can get a single player by adding the id as a parameter: /players/<id>
[GET] https://fake-mlb-api.onrender.com/players/1
[
{
"bat": "R",
"id": 1,
"thw": "L","ht": "6\' 1\"",
"birth_place": "Riverton, UT",
"status": true,
"updated_at": "2023-12-06T15:29:53.009827",
"pos": "RP","name": "Tanner Banks",
"age": 32,
"wt": 210,
"created_at": "2023-12-06T15:29:53.009777",
"team_id": 1
} ,
]
You can create a new player by sending an object like the following to /player
(Permission required)
[POST] https://fake-mlb-api.onrender.com/players
#Body
{
"bat": "R",
"age": 25,
"birth_place": "Miami, FL",
"ht": "6' 3\"",
"name": "Peter Gregory",
"pos": "CF",
"team_id": 5,
"thw": "R",
"wt": 210
}
"Player Created"
You can update a product by sending an object like the following and adding the id as a parameter: /player/<id>
(Permission required)
[PUT] https://fake-mlb-api.onrender.com/players/1
#Body
{
"bat": "R",
"age": 25,
"birth_place": "Miami, FL",
"ht": "6' 3\"",
"name": "Peter Gregory New",
"pos": "CF",
"team_id": 5,
"thw": "R",
"wt": 210
}
"Player Peter Gregory New has ben updeted"
You can delete a Player by adding the id as a parameter: /products/<id>
(Permission required)
[DELETE] https://fake-mlb-api.onrender.com/players/1
Player Deleted
You can access the list of teams by using the /teams endpoint.
[GET] https://fake-mlb-api.onrender.com/teams
[
{
"name": "Chicago White Sox",
"logo": "https://a.espncdn.com/combiner/i?img=/i/teamlogos/mlb/500/chw.png&h=200&w=200",
"city": "Chicago",
"league_id": 2,
"id": 1,
"updated_at": "2023-12-06T15:29:53.009827",
"status": true,
} ,
//...
]
You can get a single team by adding the id as a parameter: /teams/<id>
[GET] https://fake-mlb-api.onrender.com/teams/1
[
{
"name": "Chicago White Sox",
"logo": "https://a.espncdn.com/combiner/i?img=/i/teamlogos/mlb/500/chw.png&h=200&w=200",
"city": "Chicago",
"league_id": 2,
"id": 1,
"updated_at": "2023-12-06T15:29:53.009827",
"status": true,
} ,
]
You can create a new team by sending an object like the following to /teams
(Permission required)
[POST] https://fake-mlb-api.onrender.com/teams
#Body
{
"city": "Kansas",
"league_id": 2,
"logo": "https://a.espncdn.com/i/headshots/mlb/players/full/38106.png",
"name": "Kansas City Royals"
}
"Team Created"
You can update a team by sending an object like the following and adding the id as a parameter: /team/<id>
(Permission required)
[PUT] https://fake-mlb-api.onrender.com/teams/2
#Body
{
"city": "Kansas",
"league_id": 2,
"logo": "https://a.espncdn.com/i/headshots/mlb/players/full/38106.png",
"name": "Kansas City Royals"
}
"Team: Kansas updated successfully"
You can delete a Team by adding the id as a parameter: /team/<id>
(Permission required)
[DELETE] https://fake-mlb-api.onrender.com/teams/2
Team Deleted
You can access the list of leagues by using the /leagues endpoint.
[GET] https://fake-mlb-api.onrender.com/leagues
[
{
"name": "National league",
"id": 1,
"status": true,
"country": "United States",
} ,
//...
]
You can get a single league by adding the id as a parameter: /leagues/<id>
[GET] https://fake-mlb-api.onrender.com/leagues/1
{
"name": "National league",
"id": 1,
"status": true,
"country": "United States",
}
You can create a new league by sending an object like the following to /league
(Permission required)
{
"name": "National league",
"country": "United States"
}
"League National league Created"
You can update a league by sending an object like the following and adding the id as a parameter: /leagues/<id>
(Permission required)
{
"name": "National league New",
"country": "United States"
}
"League National league New has ben updeted"
You can delete a League by adding the id as a parameter: /leagues/<id>
(Permission required)
[DELETE] https://fake-mlb-api.onrender.com/leagues/1
League Deleted
You can create a new user by sending an object like the following to /user
[POST] https://fake-mlb-api.onrender.com/users
#Body
{
"email": "[email protected]",
"first_name": "Peter",
"last_name": "Gregory",
"password": "SecurityPassword Ex4mpl3 !",
"phone_number": 5555551234
}
"User Peter Gregory Created"
You can update a user password by sending an object like the following and adding the id as a parameter: /users/<id>
(Permission required)
[PUT] https://fake-mlb-api.onrender.com/users
#Body
{
"password": "SecurityPassword Ex4mpl3 ! New"
}
"User: Peter Gregory updated successfully"
You can do login by sending an object like the following to /auth/login.
{
"email": "[email protected]",
"password": "SecurityPassword Ex4mpl3 !"
}
"eyJmdWxsX25hbWUiOiJOYXZvciBJdHVydmkiLCJlbWFpbCI6Im5hdm9yaXR1cnZpMzRAZ21haWwuY29tIiwiZ3JvdXBfaWQiOjQsImNyZWF0ZWRfYXQiOiIyMDIzLTEyLTA2VDE0OjQ0sdfHJkjhKJHhhkjHLM2OCIsInVwZGF0ZWRfYXQiOiIyMDIzLTEyLTA2VDE0OjQ0OjUzLjMxMjcwOCIsImZpcnN0X25hbWUiOiJOYXZvciIsImxhc3RfbmFtZSI6Ikl0dXJ2aSIsImlkIjo0LCJwYXNzd29yZCI6IiQyYiQxMiRzNG9ySUdBVDQxdVFSczF1cHNUa3VlVFBXam1oM21JdEFNcGVjbjlQWnpnNllZbzNGcUptMiIsInBob25lX251bWJlciI6MSwiZXhwIjoxNzAyMjY2MDI0fQ.QJ0G43NpN5H-bcGS3rmzqUIJlza1qeR2KdzVRo3M8vA,"
}Attribute | Type | Description |
---|---|---|
id | BIGINT | Primary Key |
name | VARCHAR | Name of player |
pos | VARCHAR | Position of player in field |
bat | VARCHAR | Left or right-handed stance batting |
thw | VARCHAR | Left or right-handed pitching |
age | Integer | Age of player |
ht | VARCHAR | Height of player (ft ") |
wt | Integer | Weith of player (lbs) |
birth_place | VARCHAR | birth place of player |
Attribute | Type | Description |
---|---|---|
id | INT | Primary Key |
name | VARCHAR | Name of team |
logo | VARCHAR | url of image |
city | VARCHAR | city of team |
Attribute | Type | Description |
---|---|---|
id | INT | Primary Key |
name | VARCHAR | Name of team |
country | VARCHAR | Country of league |