mirror of
https://github.com/snazy2000/SnipeitPS.git
synced 2025-12-13 18:02:30 +00:00
Be quiet when deleting
This commit is contained in:
parent
193f3f7f11
commit
508e484b17
15 changed files with 15 additions and 16 deletions
|
|
@ -111,17 +111,30 @@
|
|||
Write-Error $($webResponse.messages | Out-String)
|
||||
}
|
||||
else {
|
||||
|
||||
#update operations return payload
|
||||
if ($webResponse.payload){
|
||||
$result = $webResponse.payload
|
||||
}
|
||||
#Search operations return rows
|
||||
elseif ($webResponse.rows) {
|
||||
$result = $webResponse.rows
|
||||
} else {
|
||||
}
|
||||
#Remove operations returns status and message
|
||||
elseif ($webResponse.status -eq 'success'){
|
||||
$result = $webResponse.payload
|
||||
}
|
||||
#get operations with id returns just one object
|
||||
else {
|
||||
$result = $webResponse
|
||||
}
|
||||
|
||||
Write-Verbose "Status: $($webResponse.status)"
|
||||
Write-Verbose "Messages: $($webResponse.messages)"
|
||||
|
||||
$result
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
catch {
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ function Remove-SnipeitAccessory ()
|
|||
$Parameters = @{
|
||||
Uri = "$url/api/v1/accessories/$accessory_id"
|
||||
Method = 'Delete'
|
||||
Body = @{}
|
||||
Token = $apiKey
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ function Remove-SnipeitAsset ()
|
|||
$Parameters = @{
|
||||
Uri = "$url/api/v1/hardware/$asset_id"
|
||||
Method = 'Delete'
|
||||
Body = '@{}'
|
||||
Token = $apiKey
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@ function Remove-SnipeitAssetMaintenance {
|
|||
$Parameters = @{
|
||||
Uri = "$url/api/v1/maintenances/$maintenance_id"
|
||||
Method = 'Delete'
|
||||
Body = '@{}'
|
||||
Token = $apiKey
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ function Remove-SnipeitCategory ()
|
|||
$Parameters = @{
|
||||
Uri = "$url/api/v1/categories/$category_id"
|
||||
Method = 'Delete'
|
||||
Body = '@{}'
|
||||
Token = $apiKey
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ function Remove-SnipeitCompany ()
|
|||
$Parameters = @{
|
||||
Uri = "$url/api/v1/companies/$company_id"
|
||||
Method = 'Delete'
|
||||
Body = '@{}'
|
||||
Token = $apiKey
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ function Remove-SnipeitComponent ()
|
|||
$Parameters = @{
|
||||
Uri = "$url/api/v1/components/$component_id"
|
||||
Method = 'Delete'
|
||||
Body = '@{}'
|
||||
Token = $apiKey
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ function Remove-SnipeitConsumable ()
|
|||
$Parameters = @{
|
||||
Uri = "$url/api/v1/consumables/$consumable_id"
|
||||
Method = 'Delete'
|
||||
Body = '@{}'
|
||||
Token = $apiKey
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ function Remove-SnipeitCustomField ()
|
|||
$Parameters = @{
|
||||
Uri = "$url/api/v1/fields/$field_id"
|
||||
Method = 'Delete'
|
||||
Body = '@{}'
|
||||
Token = $apiKey
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ function Remove-SnipeitDepartment ()
|
|||
$Parameters = @{
|
||||
Uri = "$url/api/v1/departments/$department_id"
|
||||
Method = 'Delete'
|
||||
Body = '@{}'
|
||||
Token = $apiKey
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ function Remove-SnipeitLicense ()
|
|||
$Parameters = @{
|
||||
Uri = "$url/api/v1/licenses/$license_id"
|
||||
Method = 'Delete'
|
||||
Body = '@{}'
|
||||
Token = $apiKey
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ function Remove-SnipeitLocation ()
|
|||
$Parameters = @{
|
||||
Uri = "$url/api/v1/locations/$asset_id"
|
||||
Method = 'Delete'
|
||||
Body = '@{}'
|
||||
Token = $apiKey
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ function Remove-SnipeitManufacturer ()
|
|||
$Parameters = @{
|
||||
Uri = "$url/api/v1/manufacturers/$manufacturer_id_id"
|
||||
Method = 'Delete'
|
||||
Body = '@{}'
|
||||
Token = $apiKey
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ function Remove-SnipeitModel ()
|
|||
$Parameters = @{
|
||||
Uri = "$url/api/v1/models/$model_id"
|
||||
Method = 'Delete'
|
||||
Body = '@{}'
|
||||
Token = $apiKey
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ function Remove-SnipeitUser ()
|
|||
$Parameters = @{
|
||||
Uri = "$url/api/v1/users/$user_id"
|
||||
Method = 'Delete'
|
||||
Body = '@{}'
|
||||
Token = $apiKey
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue