Skip to content

Delete tag with special characters like '#' does not work #675

Closed

Description

@tv-terminator

I found that if the tag contains encodable characters such as '#' (which is quite commonly used for tagging!), the delete tag request neither succeeds nor throws an exception.

url = "{0}/{1}/tags/{2}".format(baseurl, resource_id, tag_name)

Activity

  1. bcantoni commented on Aug 29, 2020

    @bcantoni
    Contributor

    @tv-terminator there could be an issue there (I think we have or had a similar bug with encoding special characters). Can you give a fuller code snippet example of how you're trying to delete tags? Also what type of resource are the tags associated with?

  2. tv-terminator commented on Aug 29, 2020

    @tv-terminator
    Author

    I have tried both workbooks & datasources; ended up with same result. Heres a full log with code:

    `# w = workbook_item, t = tableau connection/hook

    w=t.workbooks_get(get_by_content_url='POC')[0]
    w
    <tableauserverclient.models.workbook_item.WorkbookItem object at 0x7f1116314e10>
    w.tags
    set()
    w.tags.add('#test')
    w.tags
    {'#test'}
    t.workbooks_update(w)
    [2020-08-28 19:43:18,196] {{resource_tagger.py:47}} INFO - Updated tags to {'#test'}
    [2020-08-28 19:43:18,283] {{workbooks_endpoint.py:89}} INFO - Updated workbook item (ID: xxxxxx-xxxxxx-xxxxx-xxxxx)
    <tableauserverclient.models.workbook_item.WorkbookItem object at 0x7f1118fa3f28>
    w=t.workbooks_get(get_by_content_url='POC')[0]
    w.tags
    {'#test'}
    w.tags.remove('#test')
    w.tags
    set()
    t.workbooks_update(w)
    [2020-08-28 19:44:10,195] {{resource_tagger.py:47}} INFO - Updated tags to set()
    [2020-08-28 19:44:10,259] {{workbooks_endpoint.py:89}} INFO - Updated workbook item (ID: xxxxxx-xxxxxx-xxxxx-xxxxx)
    <tableauserverclient.models.workbook_item.WorkbookItem object at 0x7f1116f73400>
    w=t.workbooks_get(get_by_content_url='POC')[0]
    w.tags
    {'#test'}
    `

    Works fine with a plain text tag:
    `

    w.tags.add('test')
    w.tags
    {'#test', 'test'}
    t.workbooks_update(w)
    [2020-08-28 19:47:38,117] {{resource_tagger.py:47}} INFO - Updated tags to {'#test', 'test'}
    [2020-08-28 19:47:38,194] {{workbooks_endpoint.py:89}} INFO - Updated workbook item (ID: xxxxxx-xxxxxx-xxxxx-xxxxx)
    <tableauserverclient.models.workbook_item.WorkbookItem object at 0x7f1116791ba8>
    w=t.workbooks_get(get_by_content_url='POC')[0]
    w.tags
    {'#test', 'test'}
    w.tags.remove('test')
    w.tags
    {'#test'}
    t.workbooks_update(w)
    [2020-08-28 19:48:19,445] {{resource_tagger.py:47}} INFO - Updated tags to {'#test'}
    [2020-08-28 19:48:19,519] {{workbooks_endpoint.py:89}} INFO - Updated workbook item (ID: xxxxxx-xxxxxx-xxxxx-xxxxx)
    <tableauserverclient.models.workbook_item.WorkbookItem object at 0x7f1116bf1ac8>
    w=t.workbooks_get(get_by_content_url='POC')[0]
    w.tags
    {'#test'}
    `

  3. changed the title [-]Delete tag does not work[/-] [+]Delete tag with special characters like '#' does not work[/+] on Sep 1, 2020
  4. bcantoni commented on Sep 1, 2020

    @bcantoni
    Contributor

    Thanks @tv-terminator for the repro steps. I can confirm this is a bug and your pointer to resource_tagger.py is where we are not properly quoting the tag.

    Adding new #test tag works, put method:

    DEBUG:urllib3.connectionpool:https://10ax.online.tableau.com:443 "PUT /api/3.9/sites/MY-SITE-IT/workbooks/MY-WORKBOOK-ID/tags HTTP/1.1" 200 202
    

    Deleting the #test tag does not work, delete method throws a 405 error because "#test" is dropped from the URL:

    DEBUG:urllib3.connectionpool:https://10ax.online.tableau.com:443 "DELETE /api/3.9/sites/MY-SITE-IT/workbooks/MY-WORKBOOK-ID/tags/ HTTP/1.1" 405 377
    DEBUG:tableau.endpoint:b'<?xml version=\'1.0\' encoding=\'UTF-8\'?><tsResponse xmlns="http://tableau.com/api" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://tableau.com/api http://tableau.com/api/ts-api-3.9.xsd"><error code="405000"><summary>Method Not Allowed</summary><detail>The HTTP method \'DELETE\' is not supported for the given resource</detail></error></tsResponse>'
    

    Trying to delete a tag foo#bar shows the similar issue, with everything from the pound sign being dropped in the URL resulting in a 404:

    DEBUG:urllib3.connectionpool:https://10ax.online.tableau.com:443 "DELETE /api/3.9/sites/MY-SITE-IT/workbooks/MY-WORKBOOK-ID/tags/foo HTTP/1.1" 404 342
    DEBUG:tableau.endpoint:b'<?xml version=\'1.0\' encoding=\'UTF-8\'?><tsResponse xmlns="http://tableau.com/api" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://tableau.com/api http://tableau.com/api/ts-api-3.9.xsd"><error code="404007"><summary>Resource Not Found</summary><detail>Tag \'foo\' could not be found.</detail></error></tsResponse>'
    

    There are a few other open bugs around attributes with special characters, so hopefully we can resolve some of these together.

  5. tv-terminator commented on Sep 1, 2020

    @tv-terminator
    Author

    Awesome! Thanks @bcantoni !

  6. bcantoni commented on Sep 2, 2020

    @bcantoni
    Contributor

    Similar bugs related to encoding include #578, #516 and #418

  7. added 3 commits that reference this issue on Jun 18, 2026
    8c1554e
    04133e7
    a678379
  8. added a commit that references this issue on Jun 20, 2026
    0098271
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions