πͺπΈ DocumentaciΓ³n en EspaΓ±ol
- About
- Tech Stack
- Rate Limiting
- API Endpoints
- Response Structure
- Player Attributes
- Cache System
- Database Relations
IconicFootball-API is a RESTful API built with Laravel 12 that provides detailed information about iconic football players, including their stats, clubs, and national teams. The API features intelligent caching, rate limiting by user roles, and optimized queries for high performance.
- Framework: Laravel 12
- Database: PostgreSQL (Neon)
- Cache: Redis
- Image Storage: Cloudinary
- API Type: RESTful
The API implements rate limiting based on user categories to ensure fair usage and optimal performance:
| Category | Requests per Minute | Identifier |
|---|---|---|
| π Public | 200 | IP Address |
| π€ Authenticated User | 250 | User ID / IP |
| π Admin | 500 | User ID / IP |
Note: When rate limit is exceeded, you'll receive a
429 Too Many Requestsresponse.
https://iconicfootball-api.fly.dev/api/players
Retrieve a paginated list of all players in the database.
Endpoint
GET /playersDefault Response (20 players per page)
{
"data": [
{
"id": 1,
"known_as": "Kahn",
"full_name": "Oliver Rolf Kahn",
"img": "https://res.cloudinary.com/.../oliver_nfalr0.png",
"prime_season": "2001-2002",
"prime_position": "GK",
"preferred_foot": "right",
"spd": 82,
"sho": 25,
"pas": 59,
"dri": 44,
"def": 95,
"phy": 92,
"prime_rating": 93,
"club_id": 1,
"country_id": 1
}
],
"meta": {
"current_page": 1,
"per_page": 20,
"total": 1,
"last_page": 1
}
}Retrieve detailed information about a specific player.
Endpoint
GET /players/{id}Example
GET https://iconicfootball-api.fly.dev/api/players/1Response
{
"player": {
"id": 1,
"known_as": "Kahn",
"full_name": "Oliver Rolf Kahn",
"img": "https://res.cloudinary.com/.../oliver_nfalr0.png",
"prime_season": "2001-2002",
"prime_position": "GK",
"preferred_foot": "right",
"spd": 82,
"sho": 25,
"pas": 59,
"dri": 44,
"def": 95,
"phy": 92,
"prime_rating": 93,
"club_id": 1,
"country_id": 1
},
"status": 200
}You can include related data (club and/or country) in your requests using the include parameter.
Endpoint
GET https://iconicfootball-api.fly.dev/api/players/1?include=club,countryResponse
{
"data": [
{
"id": 1,
"known_as": "Kahn",
"full_name": "Oliver Rolf Kahn",
"img": "https://res.cloudinary.com/.../oliver_nfalr0.png",
"prime_season": "2001-2002",
"prime_position": "GK",
"preferred_foot": "right",
"spd": 82,
"sho": 25,
"pas": 59,
"dri": 44,
"def": 95,
"phy": 92,
"prime_rating": 93,
"club_id": 1,
"country_id": 1,
"club": {
"id": 1,
"name": "FC Bayern MΓΊnich",
"logo": "https://res.cloudinary.com/.../bayern-munich.png"
},
"country": {
"id": 1,
"name": "Alemania",
"logo": "https://res.cloudinary.com/.../de_apncmu.png"
}
}
],
"meta": {
"current_page": 1,
"per_page": 20,
"total": 1,
"last_page": 1
}
}Endpoint
GET /players?include=clubResponse
{
"data": [
{
"id": 1,
"known_as": "Kahn",
"full_name": "Oliver Rolf Kahn",
"img": "https://res.cloudinary.com/.../oliver_nfalr0.png",
"prime_season": "2001-2002",
"prime_position": "GK",
"preferred_foot": "right",
"spd": 82,
"sho": 25,
"pas": 59,
"dri": 44,
"def": 95,
"phy": 92,
"prime_rating": 93,
"club_id": 1,
"country_id": 1,
"club": {
"id": 1,
"name": "FC Bayern MΓΊnich",
"logo": "https://res.cloudinary.com/.../bayern-munich.png"
}
}
],
"meta": {
"current_page": 1,
"per_page": 20,
"total": 1,
"last_page": 1
}
}Endpoint
GET /players?include=countryEndpoint
GET /players/{id}?include=club,countryExample
GET /players/1?include=club,countryResponse
{
"player": {
"id": 1,
"known_as": "Kahn",
"full_name": "Oliver Rolf Kahn",
"img": "https://res.cloudinary.com/.../oliver_nfalr0.png",
"prime_season": "2001-2002",
"prime_position": "GK",
"preferred_foot": "right",
"spd": 82,
"sho": 25,
"pas": 59,
"dri": 44,
"def": 95,
"phy": 92,
"prime_rating": 93,
"club_id": 1,
"country_id": 1,
"club": {
"id": 1,
"name": "FC Bayern MΓΊnich",
"logo": "https://res.cloudinary.com/.../bayern-munich.png"
},
"country": {
"id": 1,
"name": "Alemania",
"logo": "https://res.cloudinary.com/.../de_apncmu.png"
}
},
"status": 200
}Control the number of results per page and navigate through pages.
Endpoint
GET /players?per_page={number}Example (Get 11 players)
GET https://iconicfootball-api.fly.dev/api/players?per_page=11Note: Default pagination is 20 items per page. Maximum recommended: 20.
Endpoint
GET /players?page={number}Example
GET https://iconicfootball-api.fly.dev/api/players?page=2You can combine multiple parameters for precise queries:
Example (11 players with club and country data)
GET /players?include=club,country&per_page=11Example (Page 2 with club data)
GET /players?page=2&include=club{
"data": [
/* Array of players */
],
"meta": {
"current_page": 1,
"per_page": 20,
"total": 100,
"last_page": 5
}
}{
"player": {
/* Player object */
},
"status": 200
}{
"message": "Player not found",
"status": 404
}{
"message": "Players not found",
"status": 200
}| Attribute | Type | Description |
|---|---|---|
id |
Integer | Unique player identifier |
known_as |
String | Player's popular name |
full_name |
String | Complete legal name |
img |
String (URL) | Player's image (Cloudinary) |
prime_season |
String | Peak performance season |
prime_position |
String | Primary position during prime |
preferred_foot |
String | Preferred foot (left/right) |
spd |
Integer | Speed stat (0-99) |
sho |
Integer | Shooting stat (0-99) |
pas |
Integer | Passing stat (0-99) |
dri |
Integer | Dribbling stat (0-99) |
def |
Integer | Defense stat (0-99) |
phy |
Integer | Physical stat (0-99) |
prime_rating |
Integer | Overall rating (0-99) |
club_id |
Integer | Foreign key to club |
country_id |
Integer | Foreign key to country |
The API implements Redis caching for optimal performance:
- Cache Duration: 60 seconds
- Cache Strategy: Query-based caching
- Cache Keys: Generated from request parameters (page, per_page, include)
- Benefits: Reduced database load, faster response times
Cached Endpoints:
- β
GET /players(all combinations) - β
GET /players/{id}(all combinations)
Player
βββ belongsTo β Club
βββ belongsTo β Country
Club
βββ hasMany β Players
Country
βββ hasMany β Players
Available Relations:
club: Club information with logocountry: Country information with flag
fetch("http://your-domain.com/api/players")
.then((response) => response.json())
.then((data) => console.log(data));const url =
"http://your-domain.com/api/players?include=club,country&per_page=11";
fetch(url)
.then((response) => response.json())
.then((data) => console.log(data));curl -X GET "http://your-domain.com/api/players?include=club,country&per_page=11"- All responses are in JSON format
- All timestamps use UTC timezone
- Images are hosted on Cloudinary CDN
- API responses include proper HTTP status codes
- Pagination metadata is included in list responses
Open Source
By: ForlΓ‘n ordoΓ±ez