Does anyone have a script for deleting tickets?

mattw
mattw Member Posts: 3

We have over 100K tickets in our system that we need to get rid of, and I'm not really that good at making scripts - does anyone have one I can use?

Comments

  • tanderson
    tanderson Member Posts: 279 ✭✭✭✭

    Are you deleting tickets in Atera?

  • mattw
    mattw Member Posts: 3
  • larsandersen
    larsandersen Member Posts: 5

    Matts,

    You can do it though API, but it's 1 command per ticket, so you probably also need the "rest" of the script that can generate the commands..
    Should be doable

    Why are you deleting tickets and not just resolving them ?

    if you need help you can email me or hit me up on teams on larsandersen@comasys.dk

  • gilgi
    gilgi Administrator, Moderator, Internal Posts: 313 admin

    That's actually a good question @larsandersen
    But while I appreciate you want to help, it's better if we all learn from it here together :)

  • tanderson
    tanderson Member Posts: 279 ✭✭✭✭

    @mattw Only way to remove that many will be with API. Atera support may be able to assist.

  • mattw
    mattw Member Posts: 3

    @larsandersen I know it can be done via the API but I didn't really learn all that much from the documentation on the ticket delete API - again I'm really not that good of a script writer so that's kind of why I'm asking for help lol. I'm okay with either resolving or deleting - I think I'd prefer deletion because they're a bunch of old tickets that we've never actually looked at (in the past we've just had Atera as a backup solution for running scripts/installing screenconnect but now we want to use it for more active network monitoring) and it'd be nice to start fresh.

    @tanderson Atera support didn't help - they just said that the API is an option but they can't help with the script

  • tanderson
    tanderson Member Posts: 279 ✭✭✭✭

    API is not my forte, either. It's disappointing that Atera support is not able to assist with their own product.

  • larsandersen
    larsandersen Member Posts: 5
    edited September 13

    @gilgi i understand - i'll help in here, hoping everybody leave out sensitive information. - to be clear i would have posted the final solution here, scrubbed of sensitive information.. - i have now given a theoretical solution below

    @tanderson API is a large area to support(not to mention all the programming languages from where you can use the API), and understandable the will not deliver a complete solution. i am sure that if they were given "why doesn't this work" or similar questions they would have helped, but they probably need to see that you are able to, and is trying already for them to help. - atleast that is how many other business do on API.

    @mattw ok - so do you have a selection pattern for all those tickets you want to delete ? like everything before a certain date ? are they all open or closed tickets ?

    if it was few simple API calls you could do it manually through a prompt, but as you need to find and do a lot of loops i would suggest doing a script on a server. Personally i would do it on a webserver, make a hidden page, and just call that page for the script to execute.
    Either way you need to decide on which programming/script language you will be running it in.
    after that you basically just need to do the following commands - all calls made to the app atera com website.

    https://app.atera.com/api/v3/tickets?page=1&itemsInPage=50&ticketStatus=Open
    this will give you a list of 50 open tickets, that you can loop through looking at ticketCreatedDate to see if they are from that time where you want to just delete it.
    if it is - you call the api command

    https://app.atera.com/api/v3/tickets/[ticketnumber]
    with a DELETE request instead of a POST request.
    this command has to be run for every ticket you want to delete.

    The calling of the URL's needs to include a a few headers such as Accept, contentType and X-API-KEY

    Really is nothing more to it - the worst part is probably the looking through the results from the first URL to find the tickets with the triggering dates and finding ticket numbers, to use for the last URL

    i hope it helps

  • gilgi
    gilgi Administrator, Moderator, Internal Posts: 313 admin
    edited September 17

    @tanderson is correct. Our support does not (currently) support API issues, @larsandersen.
    Edit - I am corrected, support can help out with various issues, and it's worth opening a ticket if you have thos problems.

    It requires very different skill-sets and expertise, but I hear the request for support and better documentation and am voicing it internally.

  • larsandersen
    larsandersen Member Posts: 5
    edited September 17

    @gilgi yeah, that's what i meant :)