Skip to content

03.1 API Documentation

sunithvs edited this page Feb 23, 2025 · 2 revisions

API Documentation

The API module provides the main FastAPI application endpoints and middleware for the devb.io service.

Key Components

API Endpoints

  1. Basic Profile Endpoint

    • Route: /api/profile/basic/{username}
    • Function: fetch_basic_profile
    • Purpose: Fetches basic GitHub user profile information
    • Includes background task processing
  2. Projects Data Endpoint

    • Route: /api/profile/projects/{username}
    • Function: fetch_projects_data
    • Purpose: Fetches GitHub user's projects and languages data
  3. About Data Endpoint

    • Route: /api/profile/about/{username}
    • Function: fetch_about_data
    • Purpose: Fetches GitHub user's README content
  4. LinkedIn Profile Endpoint

    • Route: /api/profile/linkedin/{username}
    • Function: fetch_linkedin_profile
    • Purpose: Fetches LinkedIn profile data

Middleware

APIKeyMiddleware

  • Purpose: Handles API key authentication
  • Excludes certain paths: /docs, /redoc, /openapi.json
  • Validates API keys against configured settings

Caching

The API implements caching mechanisms for GitHub profiles using:

  • get_cached_github_profile function
  • Background tasks for data updates
  • Username validation middleware

Security Features

  • API Key authentication required for endpoints
  • Input validation through dependency injection
  • Rate limiting through middleware

Clone this wiki locally