< Back

Invoke-vRNIRestMethod

Sat Jan 18, 2020 10:12 pm

NAME Invoke-vRNIRestMethod



SYNOPSIS

Forms and executes a REST API call to a vRealize Network Insight Platform VM.





SYNTAX

Invoke-vRNIRestMethod [-Method <String>] [-URI <String>] [-Body <String>] [-OutFile <String>] [-ContentType

<String>] [-Connection <PSObject>] [<CommonParameters>]



Invoke-vRNIRestMethod -Server <String> -Method <String> -URI <String> [-Body <String>] [-OutFile <String>]

[-ContentType <String>] [<CommonParameters>]





DESCRIPTION

Invoke-vRNIRestMethod uses either a specified connection object as returned

by Connect-vRNIServer, or the $defaultvRNIConnection global variable if

defined to construct a REST api call to the vRNI API.



Invoke-vRNIRestMethod constructs the appropriate request headers required by

the vRNI API, including the authentication token (built from the connection

object) and the content type, before making the rest call and returning the

appropriate JSON object to the caller cmdlet.





PARAMETERS

-Server <String>

vRNI Platform server



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Method <String>

REST Method (GET, POST, DELETE, UPDATE)



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-URI <String>

URI of API endpoint (/api/ni/endpoint)



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Body <String>

Content to be sent to server when method is PUT/POST/PATCH



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-OutFile <String>

Save content to file



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ContentType <String>

Override Content-Type



Required? false

Position? named

Default value application/json

Accept pipeline input? false

Accept wildcard characters? false



-Connection <PSObject>

Pre-populated connection object as returned by Connect-vRNIServer



Required? false

Position? named

Default value

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



OUTPUTS



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



PS C:\\>Invoke-vRNIRestMethod -Method GET -Uri "/api/ni/data-sources/vcenters"



Performs a 'GET' against the URI /api/ni/data-sources/vcenters and returns

the JSON object which contains the vRNI response. This call requires the

$defaultvRNIConnection variable to exist and be populated with server and

authentiation details as created by Connect-vRNIServer, or it fails with a

message to first use Connect-vRNIServer









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



PS C:\\>$MyConnection = Connect-vRNIServer -Server vrni-platform.lab.local



PS C:\\> Invoke-vRNIRestMethod -Method GET -Uri "/api/ni/data-sources/vcenters" -Connection $MyConnection



Connects to a vRNI Platform VM and stores the connection details in a

variable, which in turn is used for the following cmdlet to retrieve

all vCenter datasources. The JSON object containing the vRNI response

is returned.











RELATED LINKS