diff --git a/SnipeitPS/Public/Get-CustomField.ps1 b/SnipeitPS/Public/Get-CustomField.ps1 index ff52aa5..6d27ed3 100644 --- a/SnipeitPS/Public/Get-CustomField.ps1 +++ b/SnipeitPS/Public/Get-CustomField.ps1 @@ -1,6 +1,9 @@ <# .SYNOPSIS - Returns a list of all Snipe-IT custom fields + Returns specific Snipe-IT custom field or a list of all custom field + + .PARAMETER id + A id of specific field .PARAMETER url URL of Snipeit system, can be set using Set-Info command @@ -16,6 +19,8 @@ function Get-CustomField() { Param( + [int]$id, + [parameter(mandatory = $true)] [string]$url, @@ -23,8 +28,14 @@ function Get-CustomField() [string]$apiKey ) + if ($id) { + $apiurl= "$url/api/v1/fields/$id" + } else { + $apiurl = "$url/api/v1/fields" + } + $Parameters = @{ - Uri = "$url/api/v1/fields" + Uri = $apiurl Method = 'Get' Token = $apiKey } diff --git a/SnipeitPS/Public/Get-Fieldset.ps1 b/SnipeitPS/Public/Get-Fieldset.ps1 index 54035b3..c068330 100644 --- a/SnipeitPS/Public/Get-Fieldset.ps1 +++ b/SnipeitPS/Public/Get-Fieldset.ps1 @@ -1,6 +1,9 @@ <# .SYNOPSIS -Gets a list of Snipe-it Fieldsets +Returns a fieldset or list of Snipe-it Fieldsets + +.PARAMETER id +A id of specific fieldset .PARAMETER url URL of Snipeit system, can be set using Set-Info command @@ -18,6 +21,8 @@ Get-Fieldset -url "https://assets.example.com" -token "token..." | Where-Object function Get-Fieldset() { Param( + [int]$id, + [parameter(mandatory = $true)] [string]$url, @@ -25,8 +30,14 @@ function Get-Fieldset() { [string]$apiKey ) + if ($id) { + $apiurl = "$url/api/v1/fieldsets/$id" + } else { + $apiurl = "$url/api/v1/fieldsets" + } + $Parameters = @{ - Uri = "$url/api/v1/fieldsets" + Uri = $apiurl Method = 'Get' Token = $apiKey }