API Management
API Management provides a comprehensive API gateway solution for managing, securing, and monitoring API routes and consumers in your MIP system. Built on Apache APISIX, it offers advanced routing, load balancing, authentication, and plugin capabilities.
Overview
The API Management module enables you to:
- Create and manage API routes
- Configure upstream services and load balancing
- Manage API consumers and authentication
- Apply plugins for security, rate limiting, and more
- Monitor API traffic and performance
Key Features
Routes Management
API routes define how incoming requests are forwarded to upstream services.
Route Configuration
Each route includes:
- Route ID: Unique identifier for the route
- Route Name: Descriptive name for the route
- URI: Request path pattern (e.g.,
/api/users/*) - HTTP Methods: Allowed HTTP methods (GET, POST, PUT, DELETE, etc.)
- Upstream Configuration: Backend service configuration
Upstream Services
Configure how requests are forwarded to backend services:
-
Load Balancing Type:
- Round Robin: Distribute requests evenly across nodes
- Consistent Hashing: Route based on request characteristics
- Least Connections: Route to node with fewest active connections
- Weighted Round Robin: Distribute based on node weights
-
Upstream Nodes: Backend service endpoints
- Host: Backend service address (IP or hostname with port)
- Weight: Node weight for load balancing (higher weight = more traffic)
Route Plugins
Enhance routes with plugins for additional functionality:
- Authentication: Secure routes with various auth methods
- Rate Limiting: Control request rates
- CORS: Configure cross-origin resource sharing
- Request/Response Transformation: Modify requests and responses
- Logging: Enhanced logging capabilities
- Caching: Cache responses for improved performance
Consumer Management
Consumers represent API clients that access your routes.
Consumer Configuration
Each consumer includes:
- Consumer ID: Unique identifier
- Username: Consumer username for identification
- Plugins: Consumer-specific plugin configurations
Authentication Methods
Configure authentication for consumers:
Basic Authentication
Traditional username/password authentication:
- Username: Consumer username
- Password: Secure password
- Credential Management: Create, update, and delete credentials
API Key Authentication
Token-based authentication:
- API Key: Unique key for the consumer
- Key Location: Header, query parameter, or cookie
- Key Name: Custom key parameter name
OAuth2 Authentication
OAuth2 protocol support:
- Client ID: OAuth2 client identifier
- Client Secret: OAuth2 client secret
- Grant Types: Supported OAuth2 grant types
- Scopes: Authorized scopes
JWT Authentication
JSON Web Token authentication:
- Secret/Public Key: Key for token verification
- Algorithm: Signing algorithm (HS256, RS256, etc.)
- Claims Validation: Validate token claims
Use Cases
API Gateway
Use API Management as a central gateway for all API traffic, providing a single entry point for clients and routing to appropriate backend services.
Microservices Architecture
Route requests to different microservices based on URI patterns, enabling a unified API surface for distributed services.
Security and Authentication
Secure APIs with various authentication methods and apply security policies consistently across all routes.
Load Balancing
Distribute traffic across multiple backend instances for high availability and performance.
Rate Limiting and Throttling
Protect backend services from overload by limiting request rates per consumer or globally.
API Versioning
Manage multiple API versions by routing to different upstream services based on URI patterns or headers.
Route Management
Creating a Route
- Navigate to API Management → Routes
- Click "Create Route"
- Configure route details:
- Enter Route ID and Name
- Specify URI pattern
- Select HTTP methods
- Configure upstream:
- Select load balancing type
- Add upstream nodes (host and weight)
- (Optional) Add plugins
- Save the route
Editing a Route
- Locate the route in the Routes table
- Click the edit icon
- Modify route configuration
- Update plugins if needed
- Save changes
Deleting a Route
- Locate the route in the Routes table
- Click the delete icon
- Confirm deletion
Adding Plugins to Routes
- Edit an existing route or create a new one
- Click "Add Plugin"
- Select plugin type
- Configure plugin parameters
- Save plugin configuration
Consumer Management
Creating a Consumer
- Navigate to API Management → Consumer
- Click "Create Consumer"
- Enter consumer username
- (Optional) Configure plugins
- Save the consumer
Adding Authentication to Consumer
- Edit an existing consumer
- Click "Add Basic Auth" (or other auth method)
- Configure authentication credentials:
- For Basic Auth: Enter username and password
- For API Key: Generate or enter API key
- For OAuth2: Configure client credentials
- For JWT: Configure secret/public key
- Save authentication configuration
Managing Consumer Credentials
View and manage all authentication credentials for a consumer:
- View Credentials: See all configured auth methods
- Update Credentials: Modify existing credentials
- Delete Credentials: Remove authentication methods
- Multiple Auth Methods: Configure multiple authentication methods per consumer
Deleting a Consumer
- Locate the consumer in the Consumer table
- Click the delete icon
- Confirm deletion (this will remove all associated credentials)
Plugin Types
Security Plugins
- Basic Auth: Username/password authentication
- API Key: Token-based authentication
- OAuth2: OAuth2 protocol support
- JWT: JSON Web Token authentication
- IP Restriction: Allow/deny based on IP addresses
- CORS: Cross-origin resource sharing configuration
Traffic Control Plugins
- Rate Limiting: Limit requests per time period
- Request Size Limiting: Limit request body size
- Response Rate Limiting: Control response rate
Transformation Plugins
- Request Transformation: Modify incoming requests
- Response Transformation: Modify outgoing responses
- Header Manipulation: Add, remove, or modify headers
Observability Plugins
- Logging: Enhanced request/response logging
- Prometheus: Export metrics to Prometheus
- Zipkin: Distributed tracing
Best Practices
- Use Descriptive Names: Give routes and consumers meaningful names
- Secure All Routes: Apply appropriate authentication to all routes
- Implement Rate Limiting: Protect backend services with rate limits
- Monitor Performance: Track API metrics and performance
- Version Your APIs: Use URI patterns for API versioning
- Load Balance Properly: Configure appropriate weights for upstream nodes
- Test Before Production: Test route configurations before deploying
- Document APIs: Maintain documentation for all routes and consumers
- Rotate Credentials: Regularly update consumer credentials
- Use HTTPS: Always use HTTPS for secure communication
- Implement CORS Carefully: Configure CORS policies appropriately
- Monitor Logs: Review API logs regularly for issues
Integration with MIP Features
API Management integrates with:
- Integration Flows: Expose integration flows as APIs
- Monitoring: Track API performance and usage
- Alert Configurations: Alert on API issues
- Security: Centralized authentication and authorization
Advanced Configuration
Custom Load Balancing
Configure advanced load balancing strategies:
- Health Checks: Monitor upstream node health
- Failover: Automatic failover to healthy nodes
- Sticky Sessions: Route requests from same client to same node
- Weighted Distribution: Fine-tune traffic distribution
Plugin Chaining
Apply multiple plugins to a route in sequence:
- Authentication plugins (execute first)
- Rate limiting plugins
- Transformation plugins
- Logging plugins (execute last)
Dynamic Routing
Configure dynamic routing based on:
- Request Headers: Route based on header values
- Query Parameters: Route based on query params
- Request Body: Route based on request content
- Client IP: Route based on client location
Troubleshooting
Route Not Working
- Verify URI pattern matches request path
- Check HTTP methods are configured correctly
- Ensure upstream nodes are accessible
- Review plugin configurations
Authentication Failures
- Verify consumer credentials are correct
- Check authentication plugin is enabled on route
- Ensure consumer has necessary permissions
- Review authentication method configuration
Performance Issues
- Check upstream node health
- Review load balancing configuration
- Analyze rate limiting settings
- Monitor backend service performance
API Management
From there, you can manage routes, consumers, and configure API gateway settings.