Filtering results from content API using metadata

Highlighted
Hi, we've been working on using the content API from Community to surface content on our website. One thing is the API doesn't allow you to filter the results based on metadata like Tags or Labels. We can only bring back the articles from a given Knowledge Base, and change the order based on Last Published, Most Viewed etc. Has anyone worked around this to then filter that list by use of a Label or such-like? We'd like to add a 'Hot Topic' label so that by default the list of content comes from the specific knowledge base, in order of Most Viewed or Last Published, but if an article has the 'Hot Topic' label then it comes first in the list. There may be one thing with this label or multiple.
Tags (1)
Message 1 of 3
2 REPLIES
Community Management
Software Development

@JMcJohnston - 

 

Did you mean filtering the articles using labels and tags?  If yes, this is feasible using API V2 calls. 

 

SELECT id FROM messages WHERE labels.text='Hot Topic'

https://community.lithium.com/t5/Developer-Documentation/bd-p/dev-doc-portal?section=commv2&collecti...

 

SELECT id FROM messages WHERE tags.text = 'Hot Topics' 

https://community.lithium.com/t5/Developer-Documentation/bd-p/dev-doc-portal?section=commv2&collecti...

 

 

Give kudos if you find my posts helpful or mark solution if it answers your query.
Tariq
Message 2 of 3

Thanks for your reply @TariqGrazitti, but this doesn’t quite solve our problem.  If we were to filter by label, users would only see ‘hot topics’, whereas our  ideal solution is to have hot topics come first, then everything else from that knowledge base.

 

Ideally, we’d want to make a LiQL query such as:

 

SELECT view_href, title FROM messages WHERE conversation.type=”board” ORDER BY label, post_time DESC

 

…but ordering by more than one column isn’t supported by API V2 calls.  The only way to do it would be to have two API calls, one to grab the hot topics and one to grab any other topics, and that would have performance concerns.

 

Any ideas?

Message 3 of 3