Skip to content

Instantly share code, notes, and snippets.

@rkaldung
Created October 26, 2021 11:45
Show Gist options
  • Select an option

  • Save rkaldung/410b55f4a45f9b555ce75d022aa62407 to your computer and use it in GitHub Desktop.

Select an option

Save rkaldung/410b55f4a45f9b555ce75d022aa62407 to your computer and use it in GitHub Desktop.

Revisions

  1. rkaldung created this gist Oct 26, 2021.
    30 changes: 30 additions & 0 deletions TicketUpdate.ps1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    $user = "John.Doe"
    $pass = "VerySecret"
    $uri = "https://FQDNotrs/nph-genericinterface.pl/Webservice/GenericTicketConnectorREST"

    $headers = @{}
    $headers.Add("Accept", "application/json")
    $headers.Add("Content-Type", "application/json")

    # Parameter see https://github.com/znuny/Znuny/blob/dev/Kernel/GenericInterface/Operation/Ticket/TicketUpdate.pm#L68
    $UpdateData = @{
    UserLogin = $user
    Password = $pass
    Ticket = @(
    Queue = "Datacenter::2nd Level"
    )
    DynamicField = @(
    @{
    Name = "Field1"
    Value = "Value1"
    },
    @{
    Name = "Field2"
    Value = "Value2"
    }
    )
    }

    $json = $UpdateData | ConvertTo-Json
    $Result = Invoke-RestMethod -Method PATCH -Headers $Headers -ContentType 'application/json' -Uri "$uri/Ticket/1" -Body $json
    Write-Host Update ticket $Result.TicketNumber