How to filter unanswered questions which were earlier responded ?

Kishan Sharma
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 31, 2021

Hi Team,

I want to search questions that I have answered and which were not marked as accepted.

There might be some questions where the reporter is awaiting subsequent response on question that I answered. Currently I need to manually search each and every question to see whether I have answered and closed the loop.

Can we get such filter ? Is there any better way to find/filter such questions ? 

2 answers

1 accepted

Suggest an answer

Log in or Sign up to answer
1 vote
Answer accepted
Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 1, 2021

Oh hey - so if you have curl and grep installed (standard in OS X Terminal), this should work:

curl -s 'https://community.atlassian.com/api/2.0/search?api.pretty_print=true&q=SELECT%20view_href%20FROM%20messages%20WHERE%20author.id=%27554991%27%20AND%20is_answer=true%20AND%20is_solution=false%20LIMIT%201000' | grep view_href

So 554991 is your @Kishan Sharma user-id, which I found by clicking on your profile.

I went overly deep into this here but the gist of it is that we're hitting the API for the Khoros software that runs the Atlassian Community, and that API does have the data you're looking for.

Here's the query broken out, and I've converted the %20s to spaces and the %27 to single quotes:

This is the endpoint:

https://community.atlassian.com/api/2.0/search?

This makes it print the JSON output nicely and then sets up the query:

api.pretty_print=true&q=

So here's the actual query, in LiQL (free account required to view docs, ugh) which is similar to SQL. To make things faster, we are only requesting one field be returned: the link (view_href) to the message:

SELECT view_href 

Here's the table we're querying, messages:

FROM messages 

And here's where we add a filter for your user-id:

WHERE author.id='554991

And then we make sure we're only getting posts where the message is an answer but it has not been accepted. So we're filtering on the is_answer and is_solution fields: 

AND is_answer=true AND is_solution=false

Max number of results is 1000. Hopefully you don't have more than 1000 unaccepted answers:

LIMIT 1000

 

Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 1, 2021
Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 1, 2021

I've added conversation.solved to the results to show if somebody else's answer has been accepted, but I can't figure out why the API won't allow me to query on that field, even though their examples show that it should work. (Enh - it has to do with depth=0 being required, which doesn't work here because your answers are all depth=1. I'll call this field broken.) 

Very odd:

https://community.atlassian.com/api/2.0/search?api.pretty_print=true&q=SELECT%20view_href,conversation.solved%20FROM%20messages%20WHERE%20author.id=%27554991%27%20AND%20is_answer=true%20AND%20is_solution=false%20LIMIT%201000

Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 1, 2021

So if you install jq, you can further filter the query for to only questions that have not been marked as answered by somebody else:

curl -s 'https://community.atlassian.com/api/2.0/search?api.pretty_print=true&q=SELECT%20view_href,conversation.solved%20FROM%20messages%20WHERE%20author.id=%27554991%27%20AND%20is_answer=true%20AND%20is_solution=false%20LIMIT%201000' | jq '.data.items[] | select(.conversation.solved==false)|.view_href'

That's curl, taking the results of the query above, piped through jq with a filter that only returns the view_href field for messages where conversation.solved is false.

Apparently 450 of your answers are in that state. So um, have fun reviewing all those. :-}

Like Kishan Sharma likes this
Kishan Sharma
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 2, 2021

Whoa that's a lot of information to absorb, I'll try and process this, thank you so much for your help :)

Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 2, 2021

Heh, sorry. Sometimes I overdo it. :-}

Yeah, luckily I dug into this previously, but it was fun to poke around at it again.

Like Kishan Sharma likes this
Kishan Sharma
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 2, 2021

don't be, sometimes it necessary too 😄 

Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 6, 2021

Ah, luckily Khoros (software that runs Atlassian Community) also has their own community, and somebody there helped me out.

The following link should give you a nice set of links to all questions that you have participated in that are still not marked as solved, per your original request:

https://community.atlassian.com/api/2.0/search?api.pretty_print=true&q=SELECT%20view_href%20FROM%20messages%20WHERE%20participants.id%20=%20%27554991%27%20AND%20author.id%20!=%20%27554991%27%20AND%20depth=0%20AND%20conversation.solved%20=%20false%20LIMIT%201000

To break the query down to be more readable:

SELECT view_href 
FROM messages 
WHERE participants.id = '554991' 
AND author.id != '554991' 
AND depth=0 AND conversation.solved = false
LIMIT 1000

So the trick here is using participants.id, which means you participated in a question (asked/answered/commented), but then we make sure you weren't the author of the original question.

I think the only problem with this is it might also include questions where you commented on somebody else's answer. To filter those out, would probably require an additional query, checking only for messages with a depth of 1 (answers). But depth can only be zero. Hrm...

Like # people like this
Kishan Sharma
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 10, 2021

This is really great help @Darryl Lee this will do for now and I'll also explore more options around this. Thanks you so very much 😃

Like # people like this
0 votes
Jack Brickey
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 31, 2021

Unfortunately, we as Community Members or Leaders do not have that ability. It has been discussed but there are limitations with the app (Khoros) that complicate implementation.

Kishan Sharma
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 2, 2021

Thank you for the information Jack!

TAGS
AUG Leaders

Atlassian Community Events