What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

API call to close PRTG Ticket

Votes:

0

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

api closed tickets

Created on Jul 29, 2019 7:58:23 AM



5 Replies

Votes:

0

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.

Created on Jul 29, 2019 8:13:57 AM by  Dariusz Gorka [Paessler Support]



Votes:

0

Thank you for your response

Created on Aug 7, 2019 7:46:02 AM



Votes:

0

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

Created on Jan 30, 2023 11:14:40 PM



Votes:

1

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

Created on Feb 1, 2023 7:46:24 PM



Votes:

0

Thanks for sharing crawc!


Kind regards,
Felix Saure, Technical Support Team

Created on Feb 2, 2023 6:27:03 AM by  Felix Saure [Paessler Support]




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.