We will start by pulling up the Get-CWMTemplate and, opening up the API documentation for the endpoint we are working with.
We create a new file Get-CWMTicketTask.ps1 in the appropriate directory and, update the function name to match.
We then want to update the to match the endpoint we are using.
Add a parameter for parentId and make it mandatory.
parentId
function Get-CWMTicketTask { [CmdletBinding()] param( [Parameter(Mandatory=$true)] [int]$parentId, [int]$id, [string]$Condition, [ValidatePattern('\S* (desc|asc)')] [string]$orderBy, [string]$childConditions, [string]$customFieldConditions, [int]$page, [int]$pageSize, [string[]]$fields, [switch]$all ) $Endpoint = "/service/tickets/$($parentId)/tasks" if($id){ $Endpoint = Join-Url $Endpoint $id } return Invoke-CWMGetMaster -Arguments $PsBoundParameters -Endpoint $Endpoint }
All done, it is that easy to add a new GET endpoint.
There was an error while loading. Please reload this page.