Request/Task/Remove-SDPRequestTask.ps1
Function Remove-SDPRequestTask { <# .SYNOPSIS Delete Request Task by id .PARAMETER RequestId Request id .PARAMETER TaskId Task id .EXAMPLE $Status = Remove-SDPRequestTask -RequestId 54321 -TaskId 12345 .NOTES Author: Michal Gajda .LINK https://www.manageengine.com/products/service-desk/sdpod-v3-api/requests/request_note.html#delete-request-note #> [CmdletBinding( SupportsShouldProcess=$True, ConfirmImpact="Low" )] param ( [String]$UriSDP, [String]$ApiKey, [Parameter(Mandatory=$true, ValueFromPipeline)] [Int]$RequestId, [Parameter(Mandatory=$true)] [Int]$TaskId ) 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 = "DELETE" EntityUri = "/api/v3/requests/$RequestId/tasks/$TaskId" } #Send request If ($PSCmdlet.ShouldProcess($TaskId,"Delete request task by id")) { $Result = Invoke-SDPAPIEntity @InvokeParams $Results = $Result.response_status } #Return result if($MyInvocation.BoundParameters.ContainsKey("Debug")) { Return $Result } else { Return $Results } } End{} } |