Forum Discussion

phoneboy's avatar
phoneboy
Director
4 years ago

How do you query for user-defined labels used in a given board (not the current one)?

Looking at the developer documentation for labels, it seems the only constraint allowed is a specific message ID.
There doesn't appear to be a way to query a given board for the labels in use.
Is it possible to do this?

I'm asking this because the built-in Labels component does NOT work on things that aren't boards (Group Hub page, for instance) and is only scoped for the current board and not, say, a different board than you're currently on.

  • I don't believe there is a way to get the labels via API v2 (i.e. LiQL) since, as you said, the only constraint in the message ID.  That being said, if you're trying to retrieve messages with a particular label then that can be done via the messages collection and the labels.text constraint. 

    But since it sounds like you're wanting a list of the actual labels used in a node to replicate the Popular Labels component or something similar, I would suggest using the API v1 Board.labels endpoint which should do the trick.

     

2 Replies

  • I don't believe there is a way to get the labels via API v2 (i.e. LiQL) since, as you said, the only constraint in the message ID.  That being said, if you're trying to retrieve messages with a particular label then that can be done via the messages collection and the labels.text constraint. 

    But since it sounds like you're wanting a list of the actual labels used in a node to replicate the Popular Labels component or something similar, I would suggest using the API v1 Board.labels endpoint which should do the trick.

     

  • I always forget about the v1 API.
    Thanks, that got me going in the right direction šŸ™‚