Request/Set-SDPRequest.ps1
Function Set-SDPRequest { <# .SYNOPSIS Update request .PARAMETER RequestId Request id .PARAMETER InputData Input data as hashtable or JSON string .EXAMPLE $InputData = @{ "request"= @{ "subject"= "Testowa Awaria" "description"= "Awaria" } } $Request = Set-SDPRequest -RequestId 28560 -InputData $InputData .NOTES Author: Michal Gajda .LINK https://www.manageengine.com/products/service-desk/sdpod-v3-api/requests/request.html#edit-request #> [CmdletBinding( SupportsShouldProcess=$True, ConfirmImpact="Low" )] param ( [String]$UriSDP, [String]$ApiKey, [Parameter(Mandatory=$true, ValueFromPipeline)] [Int]$RequestId, [Parameter(Mandatory=$true)] $InputData ) Begin { #Create headers if(!$MyInvocation.BoundParameters.ContainsKey("UriSDP")) { $UriSDP = $Global:UriSDP } if(!$MyInvocation.BoundParameters.ContainsKey("ApiKey")) { $ApiKey = $Global:ApiKey } } Process { $InvokeParams = @{ UriSDP = $UriSDP ApiKey = $ApiKey Method = "PUT" EntityUri = "/api/v3/requests/$RequestId" InputData = $InputData } #Send request If ($PSCmdlet.ShouldProcess($RequestId,"Update request by id")) { $Result = Invoke-SDPAPIEntity @InvokeParams $Results = $Result.request } #Return result if($MyInvocation.BoundParameters.ContainsKey("Debug")) { Return $Result } else { Return $Results } } End{} } |