3

In practice, I don't know the IDs of the questions, but I can search for answers by given tag(s).

The problem is how to find (newly) accepted answers. The "activity time" does not work for this.

For example, see this question. It has key times like this:

Question:

      Last activity time: 22 Sep 2015 06:37:51 GMT

Accepted answer:

      Last activity time: 22 Sep 2015 06:37:51 GMT
      Accepted time:      Around 22 Sep 2015 17:00:00 GMT

The last activity time of question/answer is not changed when the answer is accepted.

So, how to monitor if an answer is accepted? The API routes only take creation time or last activity time.

2

The API does not provide a good way for this.

Worst case, your app will have to keep a table of every question in the tags of interest. Poll that table and see if the accept status has changed from the last stored answer id, if any.

Beware that, depending on what tags you search, and how often you poll, your app may bust its quota.


If you don't mind data that's up to a week old, you can use the Data Explorer (SEDE) to get answers by tag and by accept date.

See this query of Answers that were accepted after a given date and for given tags.



If/Once you know the question IDs, you can use the /questions/{ids}/timeline route to determine the exact time an answer was accepted.
For example, your sample question shows the following times in the API:

"timeline_type": "question"         =>  creation_date = 1442856640 (2015-09-21 17:30:40 UTC)
"timeline_type": "answer"           =>  creation_date = 1442903871 (2015-09-22 06:37:51 UTC)
"timeline_type": "accepted_answer"  =>  creation_date = 1442943688 (2015-09-22 17:41:28 UTC)

Note that neither your sample question, nor its answer, have been edited. If they had, then "timeline_type": "revision" event(s) would have appeared as well.

Also, /questions/{ids}/timeline has a fromdate parameter, which theoretically would help you. However, this is still broken.
Go upvote the bug report in the hopes that it attracts some developer love.



Finally, if you can make a case for searching by accept date, you can go to Meta Stack Exchange and make a feature request. Once it's on the main sites, then we might be able to use it via the /search paths or get it added to the API.

  • I'd hope the acceptance of an answer could trigger an update on the last activity time on the answer itself. So the current search API route can detect the newly accepted answers. Does it make more sense than searching by accept date? – Jason Li Sep 24 '15 at 20:16
  • That might make more sense, maybe, but that's not how Stack Exchange works. Accepting an answer does not update the last activity time. – Brock Adams Sep 25 '15 at 4:41

You must log in to answer this question.

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