# AzureApiManagementApiResource

- Module: [Aspire.Hosting.Azure.ApiManagement](/reference/api/typescript/aspire.hosting.azure.apimanagement.md)
- Version: `17.0.0-preview.1.26567.5`
- Kind: `handle`
- Source: [GitHub](https://github.com/microsoft/aspire/tree/2d325b13709752ba6d9a943635c5e2940a2530c0)

Represents an API hosted by an Azure API Management service.

## Definition

```typescript
interface AzureApiManagementApiResource
  extends IResource,
    IResourceWithParent,
    AzureApiManagementResource]] {
  addOperation(
      name: string,
      method: string,
      urlTemplate: string,
      displayName?: string,
      operationName?: string): AzureApiManagementOperationResource;
  withApiBackend(backend: AzureApiManagementBackendResource): AzureApiManagementApiResource;
  withApiBackendPool(backend: AzureApiManagementBackendPoolResource): AzureApiManagementApiResource;
  withApplicationInsights(
      applicationInsights: AzureApplicationInsightsResource,
      options?: AzureApiManagementDiagnosticOptions): AzureApiManagementApiResource;
  withInboundPolicy(policyXml: string): AzureApiManagementApiResource;
  withInboundPolicyFragment(fragment: AzureApiManagementPolicyFragmentResource): AzureApiManagementApiResource;
  withOpenApiDocument(
      documentPath: string,
      format?: AzureApiManagementOpenApiFormat): AzureApiManagementApiResource;
  withOpenApiEndpoint(
      documentPath?: string,
      endpointName?: string,
      format?: AzureApiManagementOpenApiFormat): AzureApiManagementApiResource;
  withPolicy(policyXml: string): AzureApiManagementApiResource;
}
```

## Methods

- [addOperation](/reference/api/typescript/aspire.hosting.azure.apimanagement/azureapimanagementapiresource/addoperation.md) -- `method` -- Adds an explicitly modeled operation to an API.
    ```typescript
  addOperation(name: string, method: string, urlTemplate: string, displayName?: string, operationName?: string): AzureApiManagementOperationResource
  ```
- [withApiBackend](/reference/api/typescript/aspire.hosting.azure.apimanagement/azureapimanagementapiresource/withapibackend.md) -- `method` -- Configures an API to route requests to a backend.
    ```typescript
  withApiBackend(backend: AzureApiManagementBackendResource): AzureApiManagementApiResource
  ```
- [withApiBackendPool](/reference/api/typescript/aspire.hosting.azure.apimanagement/azureapimanagementapiresource/withapibackendpool.md) -- `method` -- Configures an API to route requests to a backend pool.
    ```typescript
  withApiBackendPool(backend: AzureApiManagementBackendPoolResource): AzureApiManagementApiResource
  ```
- [withApplicationInsights](/reference/api/typescript/aspire.hosting.azure.apimanagement/azureapimanagementapiresource/withapplicationinsights.md) -- `method` -- Sends API-level API Management diagnostics to Application Insights.
    ```typescript
  withApplicationInsights(applicationInsights: AzureApplicationInsightsResource, options?: AzureApiManagementDiagnosticOptions): AzureApiManagementApiResource
  ```
- [withInboundPolicy](/reference/api/typescript/aspire.hosting.azure.apimanagement/azureapimanagementapiresource/withinboundpolicy.md) -- `method` -- Appends an XML policy statement to the API-level inbound policy section.
    ```typescript
  withInboundPolicy(policyXml: string): AzureApiManagementApiResource
  ```
- [withInboundPolicyFragment](/reference/api/typescript/aspire.hosting.azure.apimanagement/azureapimanagementapiresource/withinboundpolicyfragment.md) -- `method` -- Includes a policy fragment in the API-level inbound policy.
    ```typescript
  withInboundPolicyFragment(fragment: AzureApiManagementPolicyFragmentResource): AzureApiManagementApiResource
  ```
- [withOpenApiDocument](/reference/api/typescript/aspire.hosting.azure.apimanagement/azureapimanagementapiresource/withopenapidocument.md) -- `method` -- Imports an OpenAPI document from a file into an API.
    ```typescript
  withOpenApiDocument(documentPath: string, format?: AzureApiManagementOpenApiFormat): AzureApiManagementApiResource
  ```
- [withOpenApiEndpoint](/reference/api/typescript/aspire.hosting.azure.apimanagement/azureapimanagementapiresource/withopenapiendpoint.md) -- `method` -- Imports an OpenAPI document exposed by the API's target compute resource.
    ```typescript
  withOpenApiEndpoint(documentPath?: string, endpointName?: string, format?: AzureApiManagementOpenApiFormat): AzureApiManagementApiResource
  ```
- [withPolicy](/reference/api/typescript/aspire.hosting.azure.apimanagement/azureapimanagementapiresource/withpolicy.md) -- `method` -- Replaces the complete API-level policy document.
    ```typescript
  withPolicy(policyXml: string): AzureApiManagementApiResource
  ```
