Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

worklog #1

Open
rupiewicz opened this issue Jan 26, 2022 · 0 comments
Open

worklog #1

rupiewicz opened this issue Jan 26, 2022 · 0 comments

Comments

@rupiewicz
Copy link

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
            }
        }
    }
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant