Overview
This endpoint demonstrates KrakenD’s powerful aggregation and transformation capabilities by combining data from multiple GitHub API endpoints into a single response. HTTP Method:GETEndpoint:
/git/{user}
Parameters
The GitHub username to fetch data for (e.g., “octocat”)
What It Demonstrates
- Aggregation: Combines data from two separate GitHub API calls
- Field Filtering: Uses
allowto return only specific fields - Field Mapping: Renames fields (e.g.,
blog→website) - Grouping: Organizes user profile data under a
userobject - Collection Handling: Properly handles the repositories array
Request Example
Expected Response
Backend Services Called
1. GitHub User Profile
- Host:
https://api.github.com - URL Pattern:
/users/{user} - Purpose: Fetches user profile information
- Group:
user
avatar_urlnamecompanyblog(mapped towebsite)locationmailhireablefollowerspublic_repospublic_gists
2. GitHub User Repositories
- Host:
https://api.github.com - URL Pattern:
/users/{user}/repos - Purpose: Fetches user’s public repositories
- Collection: Mapped to
reposfield
KrakenD Configuration
Key Configuration Options
allow
Filters the backend response to include only the specified fields. This reduces payload size and prevents exposing unnecessary data.
mapping
Transforms field names in the response. In this example, GitHub’s blog field becomes website in the API response.
group
Nests the backend response under a specific key. The user profile data is grouped under user to organize the aggregated response.
is_collection
Indicates that the backend returns an array. Combined with mapping, this properly handles the repositories collection.
Use Cases
- Developer portfolio APIs
- GitHub integration dashboards
- User profile aggregation services
- Simplified GitHub API wrapper