mirror of
https://github.com/snazy2000/SnipeitPS.git
synced 2025-12-13 01:42:29 +00:00
get by id
This commit is contained in:
parent
d4d50d8fd5
commit
5c17660cca
2 changed files with 26 additions and 4 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue