Leagues
This endpoint allows you to retrieve the leagues and the cups.
Multi-language: This feature allows the user to manually change the language of the API response by adding value to the
lang
attribute. Example:lang=en
.
Pagination: The endpoint uses an offset and limit system. Specify the offset and limit parameters to fetch the desired range of results. The maximum and default number of results per request is 50.
Update Period: The endpoint is updated several times a day.
Recommended Calls: Limit calls to 1 every day.
You can get the image of the league by calling the following url: https://images.sportdevs.com/{hash_image}.png
Use Cases
Get leagueshttps://baseball.sportdevs.com/leagues
Search the leagues by the name
https://baseball.sportdevs.com/leagues?name=like.*Championship*
Get leagues based on the idhttps://baseball.sportdevs.com/leagues?id=eq.{id}
Get leagues from a specific class_idhttps://baseball.sportdevs.com/leagues?class_id=eq.{class_id}
Query Parameters
- id integer
Default value:
eq.2855
The id of the league
- class_id integer
Default value:
eq.17
The id of the class
- offset string
Default value:
0
Limiting and Pagination
- limit string
Default value:
50
Limiting and Pagination
- lang string
Default value:
en
Multi-language
- 200
OK
- application/json
- Schema
- Example (from schema)
Schema array
- id integer
The id of the league
Note: This is a Primary Key.
- name text
The name of the league
- importance integer
The importance level of the league
- level integer
The level of the league
- current_champion_team_id integer
The id of the team that hold the title
- current_champion_team_name text
The name of the team that hold the title
- current_champion_team_hash_image character varying
Possible values:
<= 64 characters
The name image of the team that hold the title
- current_champion_team_num_titles integer
The number of the title that the team is holding
- teams_most_titles jsonb
The ids of the teams with the most titles
- most_titles integer
The number of the most titles accomplished by one team
- primary_color character varying
Possible values:
<= 7 characters
The primary color of the league
- secondary_color character varying
Possible values:
<= 7 characters
The secondary color of the league
- start_league timestamp with time zone
The date of starting the league
- end_league timestamp with time zone
The date of ending the league
- hash_image character varying
Possible values:
<= 64 characters
The name of the image
- class_id integer
The id of the class
Note: This is a Foreign Key to
classes.id
. - class_name text
The name of the class
- class_hash_image character varying
Possible values:
<= 64 characters
The name image of the class
[
{
"id": 2855,
"name": "Olympic Games",
"importance": 0,
"current_champion_team_id": 1813,
"current_champion_team_name": "South Korea",
"current_champion_team_hash_image": "87fed7fb7c300c0085d20230e0cc4a12cf6621030847b1b775ffc41ad74758b8",
"current_champion_team_num_titles": 1,
"teams_most_titles": [
{
"team_id": 1875,
"team_name": "Cuba",
"team_hash_image": "d4066b1bc84d27be0535fd9d7126b5f474922775797d0535a310858a198b6ab0"
}
],
"most_titles": 3,
"primary_color": "#8b2130",
"secondary_color": "#b11e33",
"hash_image": "48fd16b5aa4a39d2ced7f1366239545f1dd15525b404b173cdb082431ee245de",
"class_id": 17,
"class_name": "World",
"class_hash_image": "54ce3a277537f5a196e63b6d1b57e50d019c81bcbfc68b9ca13bb6228e6b54be"
}
]