jonaswinkler/paperless-ng

[BUG] [API] GET api/tags/ responses for all tags the same "colour": 1

arittner opened this issue · 2 comments

Describe the bug
With the use of the REST API you can read the tags.

http://host:port/api/tags/

Expected result: The stored tag color should be in the response.
Observed result: Each tag object has the same color value 1.

Example:

{
    "count": 18,
    "next": null,
    "previous": null,
    "results": [
        {
            "id": 7,
            "slug": "xxx",
            "name": "Xxx",
            "colour": 1,
            "match": "",
            "matching_algorithm": 6,
            "is_insensitive": true,
            "is_inbox_tag": false,
            "document_count": 9
        },
        {
            "id": 4,
            "slug": "abc",
            "name": "Abc",
            "colour": 1,
            "match": "",
            "matching_algorithm": 6,
            "is_insensitive": true,
            "is_inbox_tag": false,
            "document_count": 17
        },
        {
            "id": 2,
            "slug": "xyz",
            "name": "Xyz",
            "colour": 1,
            "match": "",
            "matching_algorithm": 6,
            "is_insensitive": true,
            "is_inbox_tag": false,
            "document_count": 116
        },
        {
            "id": 17,
            "slug": "antrag",
            "name": "Antrag",
            "colour": 1,
            "match": "",
            "matching_algorithm": 6,
            "is_insensitive": true,
            "is_inbox_tag": false,
            "document_count": 1
        },
        {
            "id": 16,
            "slug": "bescheinigung",
            "name": "Bescheinigung",
            "colour": 1,
            "match": "Bescheinigung",
            "matching_algorithm": 1,
            "is_insensitive": true,
            "is_inbox_tag": false,
            "document_count": 4
        },

To Reproduce
Steps to reproduce the behavior:

  1. Create some tags in the UI with different colors
  2. call the REST endpoint with http://localhost:???/api/tags/?page_size=1000
  3. See error

Relevant information

  • Host OS of the machine running paperless: Windows
  • Browser: Postman or Firefox
  • Version: Paperless-ng 1.5.0
  • Installation method: Docker

Same issue with the resource call to /api/tags//

{
    "id": 17,
    "slug": "antrag",
    "name": "Antrag",
    "colour": 1,
    "match": "",
    "matching_algorithm": 6,
    "is_insensitive": true,
    "is_inbox_tag": false,
    "document_count": 1
}

Ok, I found the issue on Layer 8.

It's not a bug, the REST API must be explicit called with Accept header to define the version.

Accept: application/json; version=2

response is:

{
    "id": 17,
    "slug": "antrag",
    "name": "Antrag",
    "color": "#b3e6c5",
    "text_color": "#000000",
    "match": "",
    "matching_algorithm": 6,
    "is_insensitive": true,
    "is_inbox_tag": false,
    "document_count": 1
}