itglue / powershellwrapper

This PowerShell module acts as a wrapper for the IT Glue API.
Apache License 2.0
120 stars 51 forks source link

unable to filter archived configurations even though the API allows it #122

Closed RaavStormfang closed 3 years ago

RaavStormfang commented 3 years ago

Is your feature request related to a problem? Please describe. i'm using your API to automate a lot of grunt work that helpdesk shouldn't have to do. we are using itglue and connectwise automate. there is a status we use called "automate inactive" in glue. its a beautiful thing. trying to pull only non archived results but i'm having to filter them out

it looks like this. Get-ITGlueConfigurations -page_size 2000 -filter_configuration_status_id 20536

Describe the solution you'd like it looks like in the API you can filter on archived, but this functionality is missing from your wrapper. it would be neat if you would add it in it would look like this Get-ITGlueConfigurations -page_size 2000 -filter_configuration_status_id 20536 -filter_archived 1

Describe alternatives you've considered scripting around the problem by running a script for each company in a never ending loop increasing the pagesize to dragonballZ numbers (over9000) (works but doesn't work) crying into my pillow (does nothing, code does not improve)

Additional context I love you. this wrapper is fantastic and has made system administration of ITGLUE easy to do. thanks a bunch.

RaavStormfang commented 3 years ago

got this to work by modifying your configurations.ps1 and modifying the get-itglueconfigurations function by adding the following code blocks

[Parameter(ParameterSetName = 'index')] [Parameter(ParameterSetName = 'index_rmm')] [Parameter(ParameterSetName = 'index_psa')] [Parameter(ParameterSetName = 'index_rmm_psa')] [ValidateSet('true', 'false', '1', '0')] [String]$filter_archived = '',

if ($filter_archived) { $body += @{'filter[archived]' = $filter_archived}

and it works. because the API already has it in. nifty! i mean, its a hack job, but its not terribly bad. could we add this in to the other stuffs and make it a thing?

true and false seem to be swapped from what i would expect, but hey! it works!