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.

There seems to be a few of these "dev-tips" so I'll share a problem I have.

To notify a user of comments directed to them, we use the users/{id}/mentioned method.

However, notifying a user of answers to their questions and comments to their posts seems more difficult. In fact, it seems impossible.

Please share your solutions in the language of your choice.

share|improve this question
add comment

1 Answer

The easiest and most efficient is to maintain a cookie with a last_updated value.

Use this value as either from_date or min, depending on the query, and simply pull those records, scan for matching data, and update the cookie date.

Combine this with some sort of session cache and it may serve the case but does not provide any history.

If you add persistent storage to the equation, it is simple enough to store the last_updated in a user-specific store that maintains the records you have previously pulled and provides a reference from which to pull only new records.

While I typically shy away from technologies that are very platform/vendor specific - some of the database features being introduces in HTML5 are fairly compelling.

But, to answer the question, again:

The keystone to providing this type of feature is a reference date with which to pull records from which to extract either the data itself or the relevant post ids.

With a pagesize of 100 and all bool params (body, answers, comments) set, you should be able to update any non-skeetish user with any and all responses they have received with just a handful of queries.

share|improve this answer
    
I figured the answer would involve a cookie. Thanks for sharing your strategy. I'll see how this works in my app - which uses Soapi.JS, by the way. –  Nathan Osman Aug 17 '10 at 18:02
add comment

You must log in to answer this question.

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