Core Concepts
APIs
An API (Application Programming Interface) is an interface that exposes the functionality of a backend service. In Azure API Management, you import APIs that represent your backend services, such as web services or REST APIs. These imported APIs are then managed, secured, and published through API Management.
Operations
An operation within an API represents a specific action that can be performed, like retrieving data, creating a resource, or updating information. Each operation typically maps to an HTTP method (GET, POST, PUT, DELETE, etc.) and a URL path.
Products
Products are collections of APIs offered to developers. They act as a container for APIs and are used to group related APIs together for subscription and policy enforcement. Developers subscribe to products to gain access to the APIs included within them.
Subscriptions
A subscription is a key that developers use to gain access to APIs. When a developer subscribes to a product, they receive a subscription key. This key is then included in API requests to authenticate and authorize the developer's access.
Policies
Policies are a powerful feature of Azure API Management that allow you to modify the behavior of your APIs. They are executed in a predefined order and can be applied at different scopes (global, product, API, or operation). Common policy use cases include:
- Authentication and authorization
- Request and response transformation
- Rate limiting and throttling
- Caching
- Logging and tracing
Developer Portal
The Developer Portal is a self-service website where developers can discover, learn about, and consume your APIs. It provides documentation, API explorers, and subscription management capabilities, making it easy for developers to integrate with your services.
Gateway
The gateway is the front door for all client requests. It receives incoming requests, enforces policies, and forwards requests to the appropriate backend services. It also handles responses, transforms them if necessary, and returns them to the client.
Backend Services
These are the actual services that host your application logic and data. API Management acts as a facade in front of these services, abstracting their complexity and providing a consistent interface to consumers.
Key Features & Functionality
API Gateway
Provides a unified entry point for all client requests, abstracting backend services and enforcing security and governance policies.
Security
Offers robust security features including subscription keys, OAuth 2.0, JSON Web Tokens (JWT), client certificate authentication, and IP filtering to protect your APIs.
Developer Management
Facilitates easy onboarding of developers with features like registration, subscription management, and access control through products and groups.
Analytics and Monitoring
Provides insights into API usage, performance, and errors through built-in analytics and integration with Azure Monitor for deeper diagnostics.
Policy Expressions
Policy expressions allow you to write sophisticated logic within your policies using a C#-like syntax. This enables dynamic behavior based on request/response data, context, or external services.
if (context.Request.Headers.GetValueOrDefault("X-Custom-Header") == "enabled")
{
// Perform specific action
context.Response.Headers.Add("X-API-Version", "1.0");
}
API Versioning
API Management supports various strategies for API versioning, allowing you to introduce changes to your APIs without breaking existing clients. Common methods include path-based, query string, and header-based versioning.
Advanced Concepts
Custom Domains
You can associate custom domain names with your API Management gateway and developer portal for a branded experience.
Virtual Networks
API Management can be deployed within an Azure Virtual Network (VNet) to provide network isolation and secure access to private backend services.
Policy Snippets
Reusable blocks of policy logic that can be easily inserted into your API policies, promoting consistency and reducing duplication.
Backend Management
Configure and manage your backend services, including their URLs, credentials, and health probe settings.
Caching
Leverage caching mechanisms to improve API response times and reduce the load on your backend services by storing frequently accessed responses.