# AddOperation

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

Adds an explicitly modeled operation to an API.

## Definition

```go
func (AzureApiManagementApiResource) AddOperation(
    name string,
    method string,
    urlTemplate string,
    options ...*AddOperationOptions,
) AzureApiManagementOperationResource
```

## Parameters

- `name` (`string`) -- The globally unique Aspire resource name and default physical operation name.
- `method` (`string`) -- The HTTP method.
- `urlTemplate` (`string`) -- The URL template relative to the API path.
- `options` (`...*AddOperationOptions`) -- optional settings, see [Options](#options)

## Options

Optional parameters are passed in a trailing `options ...*AddOperationOptions` argument.

- `DisplayName` (`*string`) -- The operation display name. The resource name is used when omitted.
- `OperationName` (`*string`) -- The physical operation identifier in API Management. The Aspire resource name is used when omitted.

## Returns

[`AzureApiManagementOperationResource`](/reference/api/go/aspire.hosting.azure.apimanagement/azureapimanagementoperationresource.md) -- A builder for the operation resource.

Returns a handle; failures surface later via `Err()`.

## Applies to

- [`AzureApiManagementApiResource`](/reference/api/go/aspire.hosting.azure.apimanagement/azureapimanagementapiresource.md)
