Skip to content

Instantly share code, notes, and snippets.

@rkaldung
Created October 26, 2021 11:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rkaldung/410b55f4a45f9b555ce75d022aa62407 to your computer and use it in GitHub Desktop.
Save rkaldung/410b55f4a45f9b555ce75d022aa62407 to your computer and use it in GitHub Desktop.
$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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment