powershell-sdp
powershell-sdp copied to clipboard
worklog
Hello i try to add new function worklog but doesent work . Did you correct me ?
https://help.servicedeskplus.com/api/worklog-operations.html https://pitstop.manageengine.com/portal/en/community/topic/powershell-rest-api-v3-add-worklog https://pitstop.manageengine.com/portal/en/community/topic/add-request-task-worklog-api-rest
function Get-ServiceDeskworkload { param ( # ID of the ServiceDesk Plus request [Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)] [int[]] $Id,
# Base URI of the ServiceDesk Plus server, i.e. https://sdp.example.com
[Parameter(Mandatory)]
$Uri,
# ServiceDesk Plus API key
[Parameter(Mandatory)]
$ApiKey
)
process {
foreach ($RequestId in $Id) {
$Parameters = @{
Body = @{
TECHNICIAN_KEY = $ApiKey
}
Method = "Get"
Uri = "$Uri/api/v3/$RequestId/worklogs"
}
$Response = Invoke-RestMethod @Parameters
foreach ($Note in $Response.notes) {
[PSCustomObject] @{
Id = $Id
NoteId = $Note.id
Public = [System.Convert]::ToBoolean($Note.show_to_requester)
RequestId = $Note.request.id
}
}
}
}
}