Ticket tags update

Hello, everyone :slight_smile: Hope you’re doing well.

I’m currently working on a custom app that integrates Freshdesk tickets with Github, and I have a question/issue. At a certain point in my workflow from my backend I’m interested in updating the ticket tags. After reading some documentation I found out it’s possible through a PUT (as you can read here ). My problem is that the PUT request also needs the status, priority and source of the ticket and even though I can get those by retrieving the ticket itself, I’m afraid I can get the ticket data integrity compromised (i.e.: for some reason someone updates any of these fields just right after I got them, so I end up changing them in a way it was not supposed to happen).

So my question here is: is there any way of only updating the tags from a ticket? Like a PATCH request that for any reason I might’ve missed from the documentation?

Thank you all very much in advance. Hope we can solve this together :slight_smile:

Hi @asilvaPasteursoft

Welcome to Freshworks developer community!

Please try with the below code snippet and check if you can update the tags.

Notes:

  1. The below code contains FDK Request method.
  2. If you update tags, the existing set of tags will be replaced with the new set of tags. So before updating please retrieve the existing set of tags if needed.
$request
      .put('https://domain.freshdesk.com/api/v2/tickets/<id>', {
        headers: {
          Authorization: `Basic ${encodedApiKey}`
        },
        json: { tags: ['tag1','tag2'] }
      })
      .done(() => {
        console.log(`Tags successfully appended!`);
      })
      .fail(console.error);

Thanks and Regards,
Mughela Chandresh

1 Like

Thank you so much!!!

This actually solved the issue :slight_smile:

1 Like

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.