Invoke-vPenTestRequest

SYNOPSIS

Makes an API request to vPenTest

SYNTAX

__AllParameterSets

Invoke-vPenTestRequest [[-Method] <string>] [-ResourceURI] <string> [[-UriFilter] <hashtable>]
 [[-MultiValueParameter] <string[]>] [[-Headers] <hashtable>] [[-Data] <Object>] [-AllResults]
 [-Raw]

ALIASES

This cmdlet has the following aliases,

  • None

DESCRIPTION

The Invoke-vPenTestRequest cmdlet invokes an API request to the vPenTest API

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

GET requests are read-only. Any other request is a write request and is never retried

EXAMPLES

EXAMPLE 1

Invoke-vPenTestRequest -Method GET -ResourceURI '/companies' -UriFilter @{ per_page = 10 }

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

EXAMPLE 2

Invoke-vPenTestRequest -ResourceURI '/assessments' -UriFilter @{ company_id = '1c9f2abf-fdd6-479f-bf11-f9d20f23adfb' } -AllResults

Returns every assessment of the company by requesting every page

EXAMPLE 3

Invoke-vPenTestRequest -Method POST -ResourceURI '/example' -Data @{ name = 'example' }

Sends a write request with a JSON body

PARAMETERS

-AllResults

Returns all items from an endpoint by requesting every page (page & per_page)

Ignored for write requests

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: ''

-Data

Optional object to send as the JSON request body

A string is sent as is and must already be JSON, any other object is converted to JSON

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

-Headers

Hashtable of additional request headers

The Authorization header cannot be overwritten

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

-Method

Defines the type of API method to use

Allowed values: ‘GET’, ‘POST’, ‘PUT’, ‘PATCH’, ‘DELETE’

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: ''

-MultiValueParameter

Defines the names of the UriFilter keys that must be sent as repeated key\value pairs instead of a comma separated list

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

-Raw

Returns the full API response object (data & pagination values such as total_count & total_pages) instead of only the data

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: ''

-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-vPenTestBaseURI

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 comma separated lists, dates are converted to UTC, and booleans 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