I want to retrieve all comments directed to a particular user (rather than comments posted by that user) within a particular time period (e.g. last 24 hours). I don't want just "mentions", which are easy enough, but also comments posted on their questions and answers. This is technically possible - by retrieving a list of all posts and then fetching comments for each of those posts. However, when certain users have posted ~12.5k answers on one site, it becomes very inefficient (~125 requests if the limit is 100 IDs per request) to retrieve what might be only one or two comments.

Is there some better solution that I have missed or this the only option we have at the moment?

1 Answer 1


You can request a user's questions and answers, and include comments=true as part of the query. This will include all of the comments for the post in question. This query is also limitable via the sort=activity and min={24 hours ago} fields. Union those comments with the ones from users/{id}/mentioned with the same sort and min fields, and you should have all the relevant comments, no? Or have I misunderstood your question?

  • 3
    Thanks, that would probably get most of the comments. However, as far as I am aware, the last activity date of a post is not updated when a comment is posted. So if I posted an answer 2 months ago and somebody posted a comment on it 1 hour ago, I don't think I'd find this comment using the approach you describe.
    – Dan Dyer
    Commented Feb 18, 2011 at 11:06

You must log in to answer this question.

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