Azure App Service API Apps

Azure API Apps is a feature of Azure App Service that allows you to build, deploy, and manage APIs in the cloud. It provides a streamlined experience for developing and consuming RESTful APIs, integrating with other Azure services, and enabling enterprise-grade features such as authentication, authorization, and versioning.

What are API Apps?

API Apps are designed to simplify the creation and management of APIs. They are built on top of Azure App Service, inheriting its scalability, reliability, and deployment capabilities. Key benefits include:

  • Managed API Lifecycle: Tools for designing, building, testing, deploying, and versioning your APIs.
  • Connectors: Easily integrate with popular SaaS applications and on-premises data sources.
  • Security: Built-in authentication and authorization features.
  • Discoverability: Make your APIs easily discoverable through mechanisms like Swagger/OpenAPI.
  • Scalability: Leverage the auto-scaling capabilities of Azure App Service.

Key Features and Concepts

API Definitions (Swagger/OpenAPI)

API Apps leverage Swagger (now OpenAPI Specification) to describe the structure of your API. This definition allows tools to automatically generate client SDKs, documentation, and perform interactive testing.

A typical Swagger definition includes:

  • Info: API title, description, version.
  • Host & Paths: Base URL and available endpoints.
  • Schemes: HTTP or HTTPS.
  • Consumes & Produces: Data formats accepted and returned (e.g., application/json).
  • Parameters: Input parameters for operations.
  • Responses: Possible responses from operations.
  • Definitions: Data models used in requests and responses.

Connectors

API Apps make it easy to connect to various services using pre-built connectors. These connectors handle the complexity of interacting with external systems, allowing you to focus on your business logic.

Some popular connectors include:

  • SQL Server
  • Salesforce
  • Dynamics 365
  • SharePoint
  • Outlook
  • And many more...

Authentication and Authorization

Secure your APIs with various authentication methods:

  • Azure Active Directory (Azure AD): Integrate with your organizational identity provider.
  • OAuth 2.0: Standard protocol for authorization.
  • API Keys: Simple key-based authentication.
  • Managed Identities: Securely access other Azure resources without managing credentials.

Developing an API App

You can develop API Apps using your preferred programming language and development tools:

  • .NET: ASP.NET Web API, .NET Core Web API
  • Node.js
  • Java
  • Python
  • PHP

Steps to Create an API App:

  1. Navigate to the Azure portal.
  2. Click "Create a resource".
  3. Search for "API App" and select it.
  4. Configure the resource group, name, runtime stack, and other settings.
  5. Deploy your API code to the created API App.

API References

GET /api/v1/products

Retrieves a list of all available products.

Response:

[
    {
        "id": "123e4567-e89b-12d3-a456-426614174000",
        "name": "Widget Pro",
        "price": 99.99,
        "description": "The ultimate widget for professionals."
    },
    {
        "id": "87654321-e89b-12d3-a456-426614174001",
        "name": "Gadget Lite",
        "price": 49.50,
        "description": "A lightweight gadget for everyday use."
    }
]

POST /api/v1/products

Creates a new product.

Request Body:

{
    "name": "New Gizmo",
    "price": 75.00,
    "description": "A brand new gizmo with advanced features."
}

Response:

{
    "id": "a1b2c3d4-e5f6-7890-1234-567890abcdef",
    "name": "New Gizmo",
    "price": 75.00,
    "description": "A brand new gizmo with advanced features."
}

For detailed API specifications, please refer to the OpenAPI (Swagger) definition associated with your API App, usually accessible at /swagger/v1/swagger.json.

Learn More