Invoke-RocketCyberRequest

SYNOPSIS

Makes an API request to the RocketCyber API

SYNTAX

__AllParameterSets

Invoke-RocketCyberRequest [[-Method] <string>] [-ResourceURI] <string> [[-UriFilter] <hashtable>]
 [[-Headers] <hashtable>] [-AllResults]

ALIASES

This cmdlet has the following aliases,

  • Invoke-RCRequest

DESCRIPTION

The Invoke-RocketCyberRequest cmdlet invokes an API request to the RocketCyber (v3) API

This is an internal function that is used by all public functions

The RocketCyber v3 API only supports read-only GET requests. Requests that fail with a 429, 502, 503, or 504 status code (or without a status code) are retried up to 3 times

The full response of the API is returned, paged endpoints return an object with the totalCount, currentPage, totalPages, dataCount, & data properties

EXAMPLES

EXAMPLE 1

Invoke-RocketCyberRequest -Method GET -ResourceURI '/v3/account' -UriFilter @{ accountId = 12345 }

Invoke a rest method against the defined resource using the provided query parameters

EXAMPLE 2

Invoke-RocketCyberRequest -ResourceURI '/v3/agents' -UriFilter @{ pageSize = 1000 } -AllResults

Returns every agent by requesting every page of the results

PARAMETERS

-AllResults

Returns all items from an endpoint by requesting every page of the results

The data of every page is combined into a single response object

Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Headers

Hashtable of additional request headers, such as the source-key header of the /v3/reportApi endpoint

The Authorization header cannot be overwritten & the values of additional headers are masked in the debug variable

Type: System.Collections.Hashtable
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 3
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Method

Defines the type of API method to use

Allowed values: ‘GET’

Type: System.String
DefaultValue: GET
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 0
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-ResourceURI

Defines the resource uri (url) path to use when creating the API call

The path is appended to the base URI defined by Add-RocketCyberBaseURI and includes the API version, such as /v3/agents

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 1
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-UriFilter

Hashtable of query string parameters to append to the resource uri

Arrays are sent as repeated key\value pairs, dates are converted to UTC, and booleans & switches are sent as lowercase true\false values

Type: System.Collections.Hashtable
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 2
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

CommonParameters

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

INPUTS

OUTPUTS

NOTES

N/A