API v2: Manipulating ticket tags

Answered

Comments

15 comments

  • Avatar
    Gary Cao

    Additional information:

    When the ticket already has tags : ["tag-1", "tag-2", "tag-3"], if I do an update API call to set tags to:

    ticket : {

    tags : ["tag-4"]

    }

    The response for that PUT request would have "tags" attribute containing all 4 tags:

    tags : ["tag-1", "tag-2", "tag-3", "tag-4"]

    But when I make another GET request to get ticket details, the "tags" attribute only contain one tag: "tag-4", which I think is correct behavior. Only the PUT response is a bit confusing.

  • Avatar
    Steven Yan

    Thanks Gary, there's still a few gaps that we're finding in API v2, this looks like one of them.   I can definitely see the use case for adding tags without needing to know what tags already exist.  

    Thanks for reporting the bugs, I will also take this feedback back to our team and see if we can bring back the old functionality.

  • Avatar
    Geoff Clare

    Is there any progress on these gaps in the tag handling in API v2?  I would like to be able to remove tags without needing to know what other tags exist.

  • Avatar
    Ryan Olson

    I'm experiencing something a little different trying to remove tags from a topic (not ticket).

    I'm trying to remove some bogus tags that came in when I imported our articles from old system.

    Lots of articles have the tags "how", "to", "can", "I", etc from our old system. I'm trying to systematically remove these.

    For example

    When I GET a topic it has tags

    "tags" : ["how", "can", "I", "remove", "tags"]

    When I PUT I'm removing the ones I don't want and PUT it back as this:

    "tags" : ["remove", "tags"]

    as others have stated when the PUT request responds it comes back exactly the same

    "tags" : ["how", "can", "I", "remove", "tags"]

    When I do the next GET request nothing has changed though.

  • Avatar
    Paul

    I'm having the same problem as Ryan, can you confirm if this is a bug in the v2 API or an issue with my json query?

  • Avatar
    DeVaris Brown

    We're addressing this issue in our current sprint. However, we won't deploy next Thursday due to the holiday. You should see this fixed 11/29. 

  • Avatar
    DeVaris Brown

    For single ticket tag updates you'll be able to pull the ticket by ID and perform the following operations:

    DELETE /api/v2/tickets/123/tags?values=[horse,cow] # Removes the two tags

    PUT /api/v2/tickets/123/tags?values=[horse,cow] # Adds the two tags

    POST /api/v2/tickets/123/tags?values=[horse,cow] # Sets the two tags

    We're working on a solution for bulk tag updates on tickets.

  • Avatar
    Ryan Olson

    DeVaris, just out of curiosity does what you said only work for tickets or does it work with topic tags also?

  • Avatar
    Stephen Honor

    DeVaris, I am having a bit of an issue with this, I am assuming whats listed at http://developer.zendesk.com/documentation/rest_api/tags.htm is correct but even when following the provided commands it doesn't appear to be working.

     

    I am trying to delete a tag called s_in_progress from a ticket but whatever I try, your way, the way provided in the documentation. Nothing appears to be working, even running the commands provided within the documentation.

     

    Any ideas or am I doing something completely wrong here?

  • Avatar
    DeVaris Brown

    @Stephen, can you email api@zendesk.com with the command you're trying to run so I can see what's going on?

  • Avatar
    DeVaris Brown

    @Ryan we don't have a topics endpoint that would allow you to manipulate tags like the tickets endpoint does. I'll mark that down as a feature request.

  • Avatar
    Brandon Grantham

     I’ve been trying to use the API to remove tags but no method I have found works. I tried the suggested method from the API documentation (DELETE /api/v2/tickets/{id}/tags.json) and the method with a query string that DeVaris Brown mentioned in the comment above.

    Here is my curl attempt :

     

    curl -X DELETE [https://zendeskSandbox.zendesk.com/api/v2/tickets/42/tags.json?values="tagToDelete"] --globoff -u  {xxx@yyyyy.com}:{password}

     

    And my response:

    {"tags":["tag","tagToDelete"]} 

    No tag is deleted.

    Has anyone been having issues with the delete tag functionality? 

    Thanks

     

  • Avatar
    Brandon K.

    Hey Brandon,

    I checked with our technical team and it looks like our documentation was wrong but was corrected yesterday. The following curl call should work:

    curl https://{subdomain}.zendesk.com/api/v2/tickets/{id}/tags.json \ 
    -X DELETE -d '{ "tags": ["customer"] }' \ 
    -H "Content-Type: application/json" -v -u {email_address}:{password}

    http://developer.zendesk.com/documentation/rest_api/tags.html

  • Avatar
    Gorka

    Hi,

    Tags update is so nice but force to make two curl cast to the Zendesk server when updating a ticket with a comment, an status updating and tag additions and removals.

    For our situation, we first read ticket tags, then made some internal changes (sometimes we need to add new tags and remove existing ones) and finally do the ticket update.

    Additional-tags, set-tags, ... behaviour was so cool to do a unique call for updating.

    Do you plan to recover that functionality?

    Thanks,

    Gorka

  • Avatar
    Sam Trachtenberg

    We've been bulk importing users with tags. We periodically need to update the users, which for us means replacing the old tags with new ones. It says in the documentation that when you bulk import users, the new tags on the CSV add to the pre-existing tags but do not replace them. Is there a solution so that the old tags can be replaced with the new?

    Thanks!!

     

Please sign in to leave a comment.

Powered by Zendesk