Skip to main content

Get Labels from Dropdown Column (Api)

  • December 22, 2021
  • 4 replies
  • 982 views

If there a query to get the labels of the dropdown column directly?

This topic has been closed for replies.

4 replies

basdebruin
  • Community Expert
  • December 22, 2021

this query (in API Playground)

{
  boards(ids: 123456789) {
    items(ids: 987654321) {
      column_values(ids: "dropdown") {
        type
        value
        text
      }
    }
    columns(ids: "dropdown") {
      id
      settings_str
    }
  }
}

return this

{
  "data": {
    "boards": [
      {
        "items": [
          {
            "column_values": [
              {
                "type": "dropdown",
                "value": "{\\"ids\\":[5,10],\\"changed_at\\":\\"2021-12-22T07:47:44.762Z\\"}",
                "text": "count me, filter"
              }
            ]
          }
        ],
        "columns": [
          {
            "id": "dropdown",
            "settings_str": "{\\"labels\\":[{\\"id\\":4,\\"name\\":\\"milestone\\"},{\\"id\\":5,\\"name\\":\\"count me\\"},{\\"id\\":9,\\"name\\":\\"label\\"},{\\"id\\":10,\\"name\\":\\"filter\\"},{\\"id\\":11,\\"name\\":\\"second\\"}]}"
          }
        ]
      }
    ]
  },
  "account_id": 123456
}

notice the difference in the column_values (showing the selected labels) and the column settings_str (showing the available labels <> id combo’s.


  • Author
  • Participating Frequently
  • December 22, 2021

Thank you Bas, this helped me a lot!, and if I want remove some of them there is any query for delisting them?


basdebruin
  • Community Expert
  • December 22, 2021

Unfortunately the settings_str is a read-only property. You can’t add / delete labels. The only way to add labels is to change the column value with the “create_when_missing” option.


  • December 29, 2021

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