InvokeApi

Invoke an API.

Syntax

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.

Type:String
Position:4
Default value:2016-11-01
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Body

The http request body.

Type:Object
Position:3
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Method

The http request method.

Type:String
Position:1
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Route

The http URL.

Type:String
Position:2
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ThrowOnFailure

Throw exception on failure if it is true.

Type:SwitchParameter
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False