2

The api function documented at http://api.stackexchange.com/docs/questions lets me list questions on a site. How do I sort this so that I see questions that are recently posted, edited, including editing the tags, or undeleted?

I could sort by "activity", but I believe that will show questions where answers were recently posted. Questions getting answered is a common event that would clutter the list unnecessarily, and I'm not interested in answers, because I'd like to filter questions according to the question content and tags only.

See also How to sort by the newest question? , but this question differs because I do want to notice old questions that were recently edited.

3

There really is no particularly satisfactory way to do this since all versions of last_activity_date conflate a question's activity with the activity of its answers.

You are going to have to fetch lots of items and filter out the chaff yourself. There are 2 main routes you can take, events or questions:


A) Use the /events route:

  1. Use a filter that includes both the event_type property and the link property. For example, filter !-*f(6qzik2j2.

  2. Ignore all returned items that don't have an event_type of either question_posted or post_edited.

  3. If the event is post_edited, you can tell if it's a question or answer by examining the link.

    Questions will have links like:

    http://stackoverflow.com/questions/13/give-me-teh-codez!
    

    Answers will have links like:

    http://stackoverflow.com/questions/13/give-me-teh-codez!/86#86
    

Pros:

  • Relatively easy to discriminate question activity.

Cons:

  • Must sift through a LOT of unwanted events.
  • Only returns up to the last 15 minutes worth of events.
  • Requires authorization (an access_token), which can be a bit of a bother.
  • No prefiltering possible. EG by tag(s)



B) Use a route that returns questions, such as /questions or /search/advanced:

  1. Choose a filter that returns:

    • bounty_closes_date (optional)
    • closed_date
    • community_owned_date
    • creation_date
    • last_activity_date
    • last_edit_date
    • locked_date
    • protected_date

  2. Fetch the results using your desired criteria. For example:
    /2.2/search/advanced?q=lastactive:1d title:how&tagged=java&filter=!Pw)kHGLaaqdgnO19(Z_c)7lVTGqJzn

  3. Ignore last_activity_date at this stage (it was useful for the sort in step 2).

  4. For each question, if one or more of the other _date properties meets your time criteria, then the question was edited recently. (bounty_closes_date needs special handling, as it might be in the future.)

Pros:

  • Can use much more sophisticated search criteria (tags, title, user, etc.)
  • Much higher signal to noise ratio in the results.
  • Can fetch unlimited results (within quota allotment), unrestricted by date.
  • No OAuth needed, much simpler to code.

Cons:

  • A bit harder to discriminate question activity from answer activity.

You must log in to answer this question.

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