< Back

Invoke-vRARestMethod

Sat Jan 18, 2020 10:01 pm

NAME Invoke-vRARestMethod



SYNOPSIS

Wrapper for Invoke-RestMethod/Invoke-WebRequest with vRA specifics





SYNTAX

Invoke-vRARestMethod -Method <String> -URI <String> [-Headers <IDictionary>] [-WebRequest] [<CommonParameters>]



Invoke-vRARestMethod -Method <String> -URI <String> [-Headers <IDictionary>] [-OutFile <String>] [-WebRequest]

[<CommonParameters>]



Invoke-vRARestMethod -Method <String> -URI <String> [-Headers <IDictionary>] [-Body <String>] [-WebRequest]

[<CommonParameters>]





DESCRIPTION

Wrapper for Invoke-RestMethod/Invoke-WebRequest with vRA specifics





PARAMETERS

-Method <String>

REST Method:

Supported Methods: GET, POST, PUT,DELETE



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-URI <String>

API URI, e.g. /identity/api/tenants



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Headers <IDictionary>

Optionally supply custom headers



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Body <String>

REST Body in JSON format



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-OutFile <String>

Save the results to a file



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-WebRequest [<SwitchParameter>]

Use Invoke-WebRequest rather than the default Invoke-RestMethod



Required? false

Position? named

Default value False

Accept pipeline input? false

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 (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

System.String

Switch





OUTPUTS

System.Management.Automation.PSObject





-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Invoke-vRARestMethod -Method GET -URI '/identity/api/tenants'













-------------------------- EXAMPLE 2 --------------------------



PS C:\\>$JSON = @"



{

"name" : "Tenant02",

"description" : "This is Tenant02",

"urlName" : "Tenant02",

"contactEmail" : "test.user@tenant02.local",

"id" : "Tenant02",

"defaultTenant" : false,

"password" : ""

}

"@



Invoke-vRARestMethod -Method PUT -URI '/identity/api/tenants/Tenant02' -Body $JSON -WebRequest











RELATED LINKS