Azure API Management REST API
Overview
The Azure API Management REST API allows you to programmatically manage your API Management service instance. You can perform operations such as creating, reading, updating, and deleting APIs, products, subscriptions, policies, and more.
This API provides a comprehensive set of endpoints for automating your API Management workflows.
Authentication
Requests to the Azure API Management REST API must be authenticated. The primary method is using an Azure Active Directory (Azure AD) token obtained for a service principal or a managed identity that has the appropriate permissions on your API Management instance. Alternatively, you can use a shared access signature (SAS) token.
API Versioning: The API supports versioning. Always specify the api-version query parameter. The current supported version is 2023-05-01.
APIs
List APIs
GET /apis?api-version=2023-05-01
Retrieves a list of all APIs within the API Management service instance.
Get API
GET /apis/{apiId}?api-version=2023-05-01
Retrieves a specific API by its ID.
Path Parameters:
| Name | Type | Description |
|---|---|---|
| apiId | string | The unique identifier for the API. |
Create API
PUT /apis/{apiId}?api-version=2023-05-01
Creates a new API or updates an existing one.
Path Parameters:
| Name | Type | Description |
|---|---|---|
| apiId | string | The unique identifier for the API. |
Request Body:
{
"properties": {
"displayName": "My New API",
"description": "A sample API",
"serviceUrl": "https://contoso.azure-api.net/myapi",
"path": "mynewapi",
"isOnline": true
}
}
Update API
PATCH /apis/{apiId}?api-version=2023-05-01
Updates an existing API.
Path Parameters:
| Name | Type | Description |
|---|---|---|
| apiId | string | The unique identifier for the API. |
Request Body:
{
"properties": {
"description": "An updated description for the API"
}
}
Delete API
DELETE /apis/{apiId}?api-version=2023-05-01
Deletes a specific API.
Path Parameters:
| Name | Type | Description |
|---|---|---|
| apiId | string | The unique identifier for the API. |
List Operations for an API
GET /apis/{apiId}/operations?api-version=2023-05-01
Retrieves a list of operations for a specific API.
Path Parameters:
| Name | Type | Description |
|---|---|---|
| apiId | string | The unique identifier for the API. |
List Revisions for an API
GET /apis/{apiId}/revisions?api-version=2023-05-01
Retrieves a list of revisions for a specific API.
Path Parameters:
| Name | Type | Description |
|---|---|---|
| apiId | string | The unique identifier for the API. |
Products
List Products
GET /products?api-version=2023-05-01
Retrieves a list of all products within the API Management service instance.
Get Product
GET /products/{productId}?api-version=2023-05-01
Retrieves a specific product by its ID.
Path Parameters:
| Name | Type | Description |
|---|---|---|
| productId | string | The unique identifier for the product. |
Create Product
PUT /products/{productId}?api-version=2023-05-01
Creates a new product or updates an existing one.
Path Parameters:
| Name | Type | Description |
|---|---|---|
| productId | string | The unique identifier for the product. |
Request Body:
{
"properties": {
"displayName": "Starter Plan",
"description": "Basic access to selected APIs.",
"termsOfServiceUrl": "https://contoso.com/terms",
"subscriptionsLimit": 100,
"state": "published"
}
}
Subscriptions
List Subscriptions
GET /subscriptions?api-version=2023-05-01
Retrieves a list of all subscriptions within the API Management service instance.
Groups
List Groups
GET /groups?api-version=2023-05-01
Retrieves a list of all groups within the API Management service instance.
Policies
Get Policy
GET /policies/{policyId}?api-version=2023-05-01
Retrieves the policy definition for a specific scope.
Path Parameters:
| Name | Type | Description |
|---|---|---|
| policyId | string | The identifier of the policy (e.g., 'global', 'product/{productId}', 'api/{apiId}', 'operation/{operationId}'). |
Set Policy
PUT /policies/{policyId}?api-version=2023-05-01
Updates the policy definition for a specific scope.
Path Parameters:
| Name | Type | Description |
|---|---|---|
| policyId | string | The identifier of the policy (e.g., 'global', 'product/{productId}', 'api/{apiId}', 'operation/{operationId}'). |
Request Body:
<policies>
<inbound>
<base />
<set-header name="X-Powered-By" exists-action="delete" />
</inbound>
<backend>
<base />
</backend>
<outbound>
<base />
</outbound>
<on-error>
<base />
</on-error>
</policies>
{
"properties": {
"format": "xml",
"value": "\n \n \n \n \n \n \n \n \n \n \n \n \n \n "
}
}
Named Values
The Named Values API allows you to manage key-value pairs that can be used to store configuration settings or secrets for your API Management service.
Common operations include listing, getting, creating, and deleting named values.
List Named Values
GET /namedvalues?api-version=2023-05-01
Diagnostics
The Diagnostics API allows you to configure logging and tracing for your API Management service. This is crucial for monitoring and troubleshooting.
You can retrieve diagnostic settings, update them, and configure properties like the backend request/response logging or frontend request/response logging.
Get Diagnostics Settings
GET /gatewaysettings/diagnostics?api-version=2023-05-01
Logs
While the REST API primarily focuses on configuration, logs themselves are typically accessed through Application Insights or Log Analytics workspaces configured for your API Management instance. The REST API doesn't directly provide log streaming.