Partilhar via


InvokeApi

Invoke an API.

Syntax

Default (Default)

InvokeApi
    [-Method] <String>
    [-Route] <String>
    [[-Body] <Object>]
    [-ThrowOnFailure]
    [[-ApiVersion] <String>]
    [<CommonParameters>]

Description

The InvokeApi cmdlet invokes an API based on input parameters. Use Get-Help InvokeApi -Examples for more detail.

Examples

EXAMPLE 1

InvokeApi -Method GET -Route $uri -Body $body -ThrowOnFailure

Call $uri API as GET method with $body input and throw exception on failure.

Parameters

-ApiVersion

The service API version.

Parameter properties

Type:String
Default value:2016-11-01
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:4
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Body

The http request body.

Parameter properties

Type:Object
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:3
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Method

The http request method.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Route

The http URL.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:2
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ThrowOnFailure

Throw exception on failure if it is true.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.