Invoke-RubrikRESTCall

SYNOPSIS

Provides generic interface to make Rubrik REST API calls

SYNTAX

General (Default)

Invoke-RubrikRESTCall -Endpoint <String> -Method <String> [-Query <PSObject>] [-Body <PSObject>]
 [-Server <String>] [-api <String>] [-WhatIf] [-Confirm] [<CommonParameters>]

QueryByUri

Invoke-RubrikRESTCall [-Endpoint <String>] [-Method <String>] -uri <String> [-Body <PSObject>]
 [-Server <String>] [-api <String>] [-WhatIf] [-Confirm] [<CommonParameters>]

BodyAsJson

Invoke-RubrikRESTCall -Endpoint <String> -Method <String> [-Body <PSObject>] [-BodyAsJson] [-Server <String>]
 [-api <String>] [-WhatIf] [-Confirm] [<CommonParameters>]

BodyAsArray

Invoke-RubrikRESTCall -Endpoint <String> -Method <String> [-Body <PSObject>] [-BodyAsArray] [-Server <String>]
 [-api <String>] [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION

The Invoke-RubrikRESTCall allows users to make raw API endpoint calls to the Rubrik REST interface. The user will need to manage the format of both the endpoint call(including resource ids) and body, but provides the option to make cmdlet independent API calls for automating Rubrik actions through PowerShell. The Rubrik API reference is found on the Rubrik device at: \/docs/v1 \/docs/v1/playground

EXAMPLES

EXAMPLE 1

Retrieve the raw output for all VMWare VMs being managed by the Rubrik device.

EXAMPLE 2

Retrieve the raw output for the VMWare VM msf-sql2016 using a query parameter.

EXAMPLE 3

Invoke-RubrikRESTCall -Endpoint 'vmware/vm/VirtualMachine:::fbcb1f51-9520-4227-a68c-6fe145982f48-vm-649/snapshot' -Method POST -Body $body

Execute an on-demand snapshot for the VMWare VM where the id is part of the endpoint.

EXAMPLE 4

Invoke-RubrikRESTCall -Endpoint 'fileset_template/bulk' -Method POST -Body $body -BodyAsArray

Creates a new fileset from the given fileset template and the given host id supporting Direct Archive. Since fileset_template/bulk expects an array, we force the single item array with the BodyAsArray parameter.

EXAMPLE 5

Creates a new fileset from the given fileset template and the given host id supporting Direct Archive. Since fileset_template/bulk expects an array, we force the single item array with the BodyAsArray parameter.

EXAMPLE 6

Refreshes the information of the Nutanix cluster

EXAMPLE 7

Displays Verbose information while not executing the query

EXAMPLE 8

$currentreport.name = "Jaap's QuokkaReport" $updatedbody = $currentreport|select * -exclude id,updatestatus,reportTemplate,reportType Invoke-RubrikRESTCall -Endpoint "report/$($currentreport.id)" -api internal -Method PATCH -Body $updatedbody -Verbose

Using this example it is possible to rename an existing report to the report name listed in the second row of this example

EXAMPLE 9

Gather all information directly from the endpoint without having to specify any header details or authentication. Get is implicitly assumed unless explicitly specified.

EXAMPLE 10

Gather all information directly from the endpoint to gather request data without having to specify any header details or authentication. Get is implicitly assumed unless explicitly specified.

PARAMETERS

-Endpoint

Rubrik API endpoint, DO NOT USE LEADING '/'

-Method

REST API method Rubrik API endpoint, DO NOT USE LEADING '/'

-uri

uri to query with Get request

-Query

Hash table body to pass to API call

-Body

Hash table body to pass to API call

-BodyAsArray

Force the body as an array (For endpoints requiring single item arrays)

-BodyAsJson

Allows to input the body as a JSON instead of a hashtable

-Server

Rubrik server IP or FQDN

-api

API version

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

-Confirm

Prompts you for confirmation before running the cmdlet.

CommonParameters

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

INPUTS

OUTPUTS

NOTES

Written by Matt Altimar & Mike Fal for community usage Twitter: @Mike_Fal GitHub: mikefal

https://rubrik.gitbook.io/rubrik-sdk-for-powershell/command-documentation/reference/invoke-rubrikrestcall

Last updated

Was this helpful?