3

The advanced search (/search/advanced) API can search for questions by tags.

But /users/{ids}/answers API doesn't take tags.

I'd like to monitor answers/comments for questions with certain tags. Is there an API which can search for answers/comments under questions with certain tags?

If not, I'll have to use the above answers API to grab all answers within a given time range. Then check if an answer's parent question has certain tags. But it doesn't look very efficient.

1 Answer 1

2

First, you'll want to go upvote the feature request to add tag search for answers, etc. (If/when you have the upvote privilege)

In the meantime, for answers by tag you can use the /search/excerpts route as long as you include is:answer in the q parameter.

For example:
      /2.2/search/excerpts?&q=is:answer&tagged=best-in-place&site=stackoverflow

gets just answers whose questions are tagged with best-in-place.


There is no workaround for comments. You can try repeatedly polling the /events route, but then you'd have to query each new event to find the tags. It would get real messy, real quick.


If you know the question IDs, you can use the /questions/{ids} route to fetch all of the answers and all of the comments under that question.

See, for example:
      /2.2/questions/6567?site=stackapps

Be sure to set/use a filter that includes answers and comments.

1
  • Good to know /search/excerpts route can do the trick for answers. Thanks!
    – Jason Li
    Commented Sep 23, 2015 at 20:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .