< Back
Invoke-vLCMRestMethod
Post
NAME Invoke-vLCMRestMethod
SYNOPSIS
Wrapper for Invoke-RestMethod/Invoke-WebRequest with vLCM specifics
SYNTAX
Invoke-vLCMRestMethod -Method <String> -URI <String> [-Headers <IDictionary>] [-WebRequest] [<CommonParameters>]
Invoke-vLCMRestMethod -Method <String> -URI <String> [-Headers <IDictionary>] [-OutFile <String>] [-WebRequest]
[<CommonParameters>]
Invoke-vLCMRestMethod -Method <String> -URI <String> [-Headers <IDictionary>] [-Body <String>] [-WebRequest]
[<CommonParameters>]
DESCRIPTION
Wrapper for Invoke-RestMethod/Invoke-WebRequest with vLCM 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. /lcm/api/v1/view/datacenter
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-vLCMRestMethod -Method GET -URI '/lcm/api/v1/view/datacenter'
-
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>$JSON = @"
{
"datacenterName": "CHICAGO_DATA_CENTER",
"city": "Chicago",
"country": "US",
"latitude": "41.8781",
"longitude": "87.6298",
"state": "Illinois"
}
"@
Invoke-vLCMRestMethod -Method PUT -URI '/lcm/api/v1/view/datacenter' -Body $JSON -WebRequest
RELATED LINKS
SYNOPSIS
Wrapper for Invoke-RestMethod/Invoke-WebRequest with vLCM specifics
SYNTAX
Invoke-vLCMRestMethod -Method <String> -URI <String> [-Headers <IDictionary>] [-WebRequest] [<CommonParameters>]
Invoke-vLCMRestMethod -Method <String> -URI <String> [-Headers <IDictionary>] [-OutFile <String>] [-WebRequest]
[<CommonParameters>]
Invoke-vLCMRestMethod -Method <String> -URI <String> [-Headers <IDictionary>] [-Body <String>] [-WebRequest]
[<CommonParameters>]
DESCRIPTION
Wrapper for Invoke-RestMethod/Invoke-WebRequest with vLCM 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. /lcm/api/v1/view/datacenter
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-vLCMRestMethod -Method GET -URI '/lcm/api/v1/view/datacenter'
-
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>$JSON = @"
{
"datacenterName": "CHICAGO_DATA_CENTER",
"city": "Chicago",
"country": "US",
"latitude": "41.8781",
"longitude": "87.6298",
"state": "Illinois"
}
"@
Invoke-vLCMRestMethod -Method PUT -URI '/lcm/api/v1/view/datacenter' -Body $JSON -WebRequest
RELATED LINKS