Dear team,

How can I change the status of a ticket using the API call, I can request the opened tickets using API, but is there any way to change the status of a ticket to closed ?

if there is no way to do it , is there any work around ? Thank you


Article Comments

Hi there,

It's not officially documented, but the following API calls should work.

To close a ticket:

/api/closeticket.htm?id=TICKET-ID&content=CLOSED-MESSAGE

To resolve a ticket:

/api/resolveticket.htm?id=TICKET-ID&content=RESOLVED-MESSAGE



Best regards.


Jul, 2019 - Permalink

Thank you for your response


Aug, 2019 - Permalink

It don't apprear the username & passhash are evaluated in this call below. I must be for documented API call and not /api/someFunction.htm calls. Can this please be enabled?

/api/closeticket.htm?id=TICKET-ID&content=CLOSED-MESSAGE &username=api&passhash= 12345


Jan, 2023 - Permalink

While testing I found I had an error in the URL and I was incorrect in that the username & passhash are not evaluated. They are! So I created this Powershell script to close the Auto-Discovery Tickets.

$prtguser = "apiuser"
$prtghash = "123456"
$match = "Auto-Discovery *"
$actiontype = "close" # "close" or "resolve"
$message = "auto close"
$hostname = "prtg.yourdomain.com"

$URI = "https://" + $hostname + "/api/table.json?content=tickets&columns=datetime,priority,parentid,message,user,status,name&filter_drel=&username=" + $prtguser + "&passhash=" + $prtghash
$response = Invoke-WebRequest $URI
$jsonObj = $([String]::new($response.Content)) | ConvertFrom-Json | select -expand tickets | select parentid,status_raw,message_raw | Where-Object {($_.message_raw -like $match) -and ($_.status_raw -EQ '1')}

foreach($id in $jsonObj.parentid) {
    $actionURI = "https://" + $hostname + "/api/" + $actiontype + "ticket.htm?username=" + $prtguser + "&passhash=" + $prtghash + "&id=" + $id + "&content=" + $message
    $result = Invoke-WebRequest $actionURI
    $res = $result.Content  -replace '<[^>]+>',''
    Write-Output "$id - $res"
}

https://gist.github.com/crawc/588e5564eebbc7752943cc91a64c9467


Feb, 2023 - Permalink

Thanks for sharing crawc!


Kind regards,
Felix Saure, Technical Support Team


Feb, 2023 - Permalink