Take the 2-minute tour ×
Stack Apps is a question and answer site for apps, scripts, and development with the Stack Exchange API. It's 100% free, no registration required.

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?

share|improve this question

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?

share|improve this answer
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 Feb 18 '11 at 11:06

You must log in to answer this question.

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