Allow to set http request method

This commit is contained in:
Petri Asikainen 2021-07-14 11:09:12 +03:00
parent ccce2ab26f
commit fd2f5c51c7
14 changed files with 90 additions and 14 deletions

View file

@ -23,8 +23,6 @@
.PARAMETER image
Asset model Image filename and path
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command

View file

@ -50,6 +50,9 @@ Image file name and path for item
.PARAMETER image_delete
Remove current image
.PARAMETER RequestType
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfoeItInfo command
@ -101,6 +104,9 @@ function Set-SnipeitAccessory() {
[switch]$image_delete=$false,
[ValidateSet("Put","Patch")]
[string]$RequestType = "Patch",
[parameter(mandatory = $true)]
[string]$url,
@ -123,7 +129,7 @@ function Set-SnipeitAccessory() {
foreach($accessory_id in $id){
$Parameters = @{
Uri = "$url/api/v1/accessories/$accessory_id"
Method = 'Patch'
Method = $RequestType
Body = $Values
Token = $apiKey
}

View file

@ -26,6 +26,9 @@ Image file name and path for item
.PARAMETER image_delete
Remove current image
.PARAMETER RequestType
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
@ -65,6 +68,9 @@ function Set-SnipeitCategory()
[switch]$image_delete=$false,
[ValidateSet("Put","Patch")]
[string]$RequestType = "Patch",
[parameter(mandatory = $true)]
[string]$url,
@ -83,7 +89,7 @@ function Set-SnipeitCategory()
foreach($category_id in $id){
$Parameters = @{
Uri = "$url/api/v1/categories/$category_id"
Method = 'Put'
Method = $RequestType
Body = $values
Token = $apiKey
}

View file

@ -17,6 +17,9 @@ Image file name and path for item
.PARAMETER image_delete
Remove current image
.PARAMETER RequestType
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
@ -48,6 +51,9 @@ function Set-SnipeitCompany()
[switch]$image_delete=$false,
[ValidateSet("Put","Patch")]
[string]$RequestType = "Patch",
[parameter(mandatory = $true)]
[string]$url,
@ -63,7 +69,7 @@ function Set-SnipeitCompany()
foreach($company_id in $id){
$Parameters = @{
Uri = "$url/api/v1/companies/$company_id"
Method = 'Patch'
Method = $RequestType
Body = $Values
Token = $apiKey
}

View file

@ -38,6 +38,9 @@ Image file name and path for item
.PARAMETER image_delete
Remove current image
.PARAMETER RequestType
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
@ -84,6 +87,9 @@ function Set-SnipeitComponent()
[switch]$image_delete=$false,
[ValidateSet("Put","Patch")]
[string]$RequestType = "Patch",
[parameter(mandatory = $true)]
[string]$url,
@ -104,7 +110,7 @@ function Set-SnipeitComponent()
foreach($component_id in $id){
$Parameters = @{
Uri = "$url/api/v1/components/$component_id"
Method = 'Patch'
Method = $RequestType
Body = $Values
Token = $apiKey
}

View file

@ -53,6 +53,9 @@ Image file name and path for item
.PARAMETER image_delete
Remove current image
.PARAMETER RequestType
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
@ -123,6 +126,9 @@ function Set-SnipeitConsumable()
[switch]$image_delete=$false,
[ValidateSet("Put","Patch")]
[string]$RequestType = "Patch",
[parameter(mandatory = $true)]
[string]$url,
@ -143,7 +149,7 @@ function Set-SnipeitConsumable()
foreach($consumable_id in $id ){
$Parameters = @{
Uri = "$url/api/v1/consumables/$consumable_id"
Method = 'Put'
Method = $RequestType
Body = $Values
Token = $apiKey
}

View file

@ -29,6 +29,9 @@
.PARAMETER help_text
Any additional text you wish to display under the new form field to make it clearer what the gauges should be.
.PARAMETER RequestType
Http request type to send Snipe IT system. Defaults to Put you could use Patch if needed.
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
@ -69,6 +72,9 @@ function Set-SnipeitCustomField()
[string]$custom_format,
[ValidateSet("Put","Patch")]
[string]$RequestType = "Put",
[parameter(mandatory = $true)]
[string]$url,
@ -88,7 +94,7 @@ function Set-SnipeitCustomField()
foreach($field_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/fields/$field_id"
Method = 'Put'
Method = $RequestType
Body = $Values
Token = $apiKey
}

View file

@ -26,6 +26,9 @@
.PARAMETER image_delete
Remove current image
.PARAMETER RequestType
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
@ -62,6 +65,9 @@ function Set-SnipeitDepartment() {
[switch]$image_delete=$false,
[ValidateSet("Put","Patch")]
[string]$RequestType = "Patch",
[parameter(mandatory = $true)]
[string]$url,
@ -78,7 +84,7 @@ function Set-SnipeitDepartment() {
foreach ($department_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/departments/$department_id"
Method = 'Put'
Method = $RequestType
Body = $Values
Token = $apiKey
}

View file

@ -59,6 +59,9 @@
.PARAMETER termination_date
Termination date for license.
.PARAMETER RequestType
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
@ -121,6 +124,9 @@ function Set-SnipeitLicense() {
[datetime]$termination_date,
[ValidateSet("Put","Patch")]
[string]$RequestType = "Patch",
[parameter(mandatory = $true)]
[string]$url,
@ -151,7 +157,7 @@ function Set-SnipeitLicense() {
foreach($license_id in $id){
$Parameters = @{
Uri = "$url/api/v1/licenses/$license_id"
Method = 'PUT'
Method = $RequestType
Body = $Values
Token = $apiKey
}

View file

@ -16,6 +16,9 @@
.PARAMETER note
Notes about checkout
.PARAMETER RequestType
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
@ -58,6 +61,9 @@ function Set-SnipeitLicenseSeat()
[string]$note,
[ValidateSet("Put","Patch")]
[string]$RequestType = "Patch",
[parameter(mandatory = $true)]
[string]$url,
@ -73,7 +79,7 @@ function Set-SnipeitLicenseSeat()
foreach($license_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/licenses/$license_id/seats/$seat_id"
Method = 'Patch'
Method = $RequestType
Body = $Values
Token = $apiKey
}

View file

@ -50,6 +50,9 @@
.PARAMETER image_delete
Remove current image
.PARAMETER RequestType
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
@ -99,6 +102,9 @@ function Set-SnipeitLocation() {
[switch]$image_delete=$false,
[ValidateSet("Put","Patch")]
[string]$RequestType = "Patch",
[parameter(mandatory = $true)]
[string]$url,
@ -116,7 +122,7 @@ function Set-SnipeitLocation() {
foreach ($location_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/locations/$location_id"
Method = 'PUT'
Method = $RequestType
Body = $Values
Token = $apiKey
}

View file

@ -29,6 +29,9 @@
.PARAMETER image_delete
Remove current image
.PARAMETER RequestType
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
@ -68,6 +71,9 @@ function Set-SnipeitModel() {
[switch]$image_delete=$false,
[ValidateSet("Put","Patch")]
[string]$RequestType = "Patch",
[parameter(mandatory = $true)]
[string]$url,
@ -85,7 +91,7 @@ function Set-SnipeitModel() {
foreach ($model_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/models/$model_id"
Method = 'put'
Method = $RequestType
Body = $Values
Token = $apiKey
}

View file

@ -15,6 +15,9 @@ Hex code showing what color the status label should be on the pie chart in the d
.PARAMETER default_label
1 or 0 - determine whether it should be bubbled up to the top of the list of available statuses
.PARAMETER RequestType
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
@ -53,6 +56,9 @@ function Set-SnipeitStatus()
[bool]$default_label,
[ValidateSet("Put","Patch")]
[string]$RequestType = "Patch",
[parameter(mandatory = $true)]
[string]$url,
@ -68,7 +74,7 @@ function Set-SnipeitStatus()
foreach($status_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/statuslabels/$status_id"
Method = 'Put'
Method = $RequestType
Body = $Values
Token = $apiKey
}

View file

@ -59,6 +59,9 @@
.PARAMETER image_delete
Remove current image
.PARAMETER RequestType
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
@ -118,6 +121,9 @@ function Set-SnipeitUser() {
[switch]$image_delete=$false,
[ValidateSet("Put","Patch")]
[string]$RequestType = "Patch",
[parameter(mandatory = $true)]
[string]$url,