Get Labels from Dropdown Column (Api)

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

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.

2 Likes

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

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.

1 Like

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