< Back

New-AzureRmApiManagementOperation

Tue Jan 29, 2019 9:29 pm

NAME New-AzureRmApiManagementOperation



SYNOPSIS

Creates an API management operation.





SYNTAX

New-AzureRmApiManagementOperation -ApiId <String> -Context <PsApiManagementContext> [-DefaultProfile <IAzureContextContainer>] [-Description

<String>] -Method <String> -Name <String> [-OperationId <String>] [-Request <PsApiManagementRequest>] [-Responses <PsApiManagementResponse[]>]

[-TemplateParameters <PsApiManagementParameter[]>] -UrlTemplate <String> [<CommonParameters>]





DESCRIPTION

The New-AzureRmApiManagementOperation cmdlet create an API operation.





PARAMETERS

-ApiId <String>

Specifies the identifier of the API management operation.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Context <PsApiManagementContext>

Specifies the instance of the PsApiManagementContext object.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-DefaultProfile <IAzureContextContainer>

The credentials, account, tenant, and subscription used for communication with azure.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Description <String>

Specifies the description of new API operation.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Method <String>

Specifies the HTTP method of the new API management operation.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Name <String>

Specifies the display name of new API management operation.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-OperationId <String>

Specifies the identifier of the API management operation.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Request <PsApiManagementRequest>

Specifies the details of the API management operation.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Responses <PsApiManagementResponse[]>

Specifies an array of possible API management operation responses.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-TemplateParameters <PsApiManagementParameter[]>

Specifies an array of parameters defined in parameter UrlTemplate . If you do not specify this parameter, a default value will be generated

based on the UrlTemplate .



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-UrlTemplate <String>

Specifies the URL template.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

None

This cmdlet does not accept any input.





OUTPUTS

Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementOperation







NOTES









Example 1: Create an API management operation



PS C:\\>$apimContext = New-AzureRmApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"

PS C:\\>New-AzureRmApiManagementOperation -Context $apimContext -ApiId $APIId -OperationId "Operation001" -Name "Operation" -Method "GET"

-UrlTemplate "/resource" -Description "Use this operation to get resource"



This command creates an API management operation.





Example 2: Create an API management operation with request and response details



PS C:\\>$apimContext = New-AzureRmApiManagementContext -ResourceGroupName "Api-Default-WestUS" -ServiceName "contoso"

PS C:\\>$RID = New-Object -TypeName Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementParameter

$RID.Name = "RID"

$RID.Description = "Resource identifier"

$RID.Type = "string"

$Query = New-Object -TypeName Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementParameter

$Query.Name = "query"

$Query.Description = "Query string"

$Query.Type = 'string'

$Request = New-Object -TypeName Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementRequest

$Request.Description = "Create/update resource request"

$DummyQp = New-Object -TypeName Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementParameter

$DummyQp.Name = 'dummy'

$DummyQp.Type = 'string'

$DummyQp.Required = $FALSE

$Request.QueryParameters = @($DummyQp)

$Header = New-Object -TypeName Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementParameter

$Header.Name = 'x-custom-header'

$Header.Type = 'string'

$Request.Headers = @($Header)

$RequestRepresentation = New-Object -TypeName Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementRepresentation

$RequestRepresentation.ContentType = 'application/json'

$RequestRepresentation.Sample = '{ "propName": "propValue" }'

$Request.Representations = @($requestRepresentation)

$Response = New-Object -TypeName Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementResponse

$Response.StatusCode = 204

PS C:\\>New-AzureRmApiManagementOperation -Context $apimContext -ApiId $APIId -OperationId "01234567890" -Name 'Create/update resource' -Method

'PUT' -UrlTemplate '/resource/{rid}?q={query}' -Description "Use this operation to create new or update existing resource" -TemplateParameters

@($rid, $query) -Request $Request -Responses @($response)



This example creates an API management operation with request and response details.







RELATED LINKS

Online Version: https://docs.microsoft.com/en-us/powers ... toperation

Get-AzureRmApiManagementOperation

Remove-AzureRmApiManagementOperation

Set-AzureRmApiManagementOperation