Invoke-ITGlueRequest

SYNOPSIS

Makes an API request to the ITGlue API

SYNTAX

__AllParameterSets

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

ALIASES

This cmdlet has the following aliases,

  • None

DESCRIPTION

The Invoke-ITGlueRequest cmdlet invokes an API request to the ITGlue API

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

GET requests are read-only. Any request that is not a GET request is a write request. Write requests are never retried

The ITGlue API uses the JSON:API format. By default only the data property of a response is returned, such as the organizations of /organizations. Use -Raw to return the full response (data, meta, links, & included)

EXAMPLES

EXAMPLE 1

Invoke-ITGlueRequest -Method GET -ResourceURI '/organizations' -UriFilter @{ 'page[size]' = 10 }

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

EXAMPLE 2

Invoke-ITGlueRequest -ResourceURI '/organizations' -UriFilter @{ 'page[size]' = 1000 } -AllResults

Returns every organization by requesting every page of the results

EXAMPLE 3

Invoke-ITGlueRequest -Method PATCH -ResourceURI '/organizations/12345' -Data @{ type = 'organizations'; attributes = @{ name = 'Celerium' } }

Sends a write request with a JSON:API body

PARAMETERS

-AllResults

Returns all items from an endpoint by requesting every page (page[number]) of the results

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

Object to send as the JSON:API request body

The object is sent as the data property of the request body, such as @{ type = ‘organizations’; attributes = @{ name = ‘Celerium’ } }

An object that already has a single top level data property is sent as is & a string is sent as is and must already be JSON

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

-Headers

Hashtable of additional request headers

The x-api-key header cannot be overwritten

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’, ‘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: ''

-Raw

Returns the full API response object (data, meta, links, & included) 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-ITGlueBaseURI

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, such as filter[name], page[size], sort, or include

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