You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
There are over 16k tags on the Community. You can view the most popular tags here.
To query posts by tags we can use the public Community API v2. The examples below only work for public posts, not posts in private boards. These are anonymous requests and can access data available to users who are not signed into the Community.
Here is the foundation of our API request:
Next, we're going to use a special query language to find our content.
LiQL, a SQL-like query language. Use a LiQL statement to define search criteria for any complex query.
Okay, then.. let's make a LiQL query!
https://community.atlassian.com/api/2.0/search?q= SELECT * FROM messages
This gets us a pile of JSON that is a list of unsorted messages and it is capped at 25 (more on that later).
Let's add some more parameters here to search by tags
WHERE tags.text = 'jira service desk'
WHERE tags.text IN ('jira service desk', 'jsd', 'jira-service-desk')
Let's limit these messages to Questions:
Maybe we want only topic messages that have no replies
AND depth = 0 AND replies.count(*) = 0
Here we go:
https://community.atlassian.com/api/2.0/search?q=SELECT * FROM messages WHERE tags.text IN ('sourcetree') AND conversation.style='qanda' AND replies.count(*) = 0 AND depth = 0
Can I sort by date? Sounds useful to me.
ORDER BY post_time DESC
Getting closer.. why are there are 25 messages? That's the default query limit. Let's increase it.
Looking good. Let's put that all together...
https://community.atlassian.com/api/2.0/search?q=SELECT * FROM messages WHERE tags.text IN ('sourcetree') AND conversation.style='qanda' AND replies.count(*) = 0 AND depth = 0 ORDER BY post_time DESC LIMIT 1000
It looks a bit ugly. Your computer shouldn't care! Okay, you're right. You can use a browser extension or another tool.. but we can make it look better in the browser without all that. Add this to the URL.
That query we just created is the same one that powers this page:
But, hopefully you will find the JSON data useful. Remember, unlike the link above, you can combine multiple tags into a single query. That's all for now folks.
Add your comments below with specific questions or concerns.
>> Updates based on comments
Query large sets of messages
To query over large sets of results you add the following to the very end of your query:
The OFFSET value must be divisible by the LIMIT value
Limit the query response
Select only the parts of the message you need instead of the wildcard *
SELECT view_href, subject, body FROM ...
Keep the questions coming!