Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Hot answers tagged

4

I don't follow, for date times the most recent date is the largest date. Sample return by events { "event_type": "question_posted", "event_id": 9369546, "creation_date": 1329777738 }, { "event_type": "comment_posted", "event_id": 11832402, "creation_date": 1329777736 } 1329777738 => Mon, 20 Feb 2012 22:42:18 GMT 1329777736 => Mon, 20 Feb 2012 ...


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: Use a filter that ...


2

This isn't possible and isn't likely to be added. Post history is by a good clip the largest chunk of data in the system. Regularly sorting by it would be prohibitively expensive on the sites themselves, much less in the API. For queries like this, we have data.stackexchange. Here's a query for the most "revised" post on a site. We also provide data dumps (...


2

This is a classic "procedural" (or "row based" or "sequential") versus "set based" issue. See Understanding “Set based” and “Procedural” approaches in SQL or any one of thousands of similar articles. The API uses SQL to get its results and the idea of requiring an arbitrary order to results is anathema in SQL -- a sign of possible deficiencies in "set ...


2

I think creation_date is a default/universal sorting, unless activity_date is available. (But you know what they say happens when you "ASSUME".)‡ Evidence for: Seems like it would be required if paging is going to work well. This post has 753 edits (759 revision entries) and the creation dates are all in descending order. This post has 429 edits (...


1

You can filter (not sort) questions (and to some extent answers) by using the /search/advanced route of the API. The q parameter allows most of the Advanced Search Options. For example, this will fetch questions tagged python with at least 2 answers, and that have a score of 50 or more:   /2.2/search/advanced?page=1&pagesize=100&q=score:50&...


1

No, the API has a limited number of sort options (just like the website itself). The best you can do with the API is to fetch all results and then perform a client-side sort. Alternatively, use SEDE which is much more flexible when it comes to sort orders, but it has the disadvantage of not providing real-time data. And it doesn't have an API, so it's only ...


1

This is most likely one of those things you'll have to do yourself and one reason why the API is available. And, it's not too hard; here is pseudo code that works: Call /questions/featured with max page-size and (ideally) filtered by your tag(s) of interest. EG: /questions/featured?pagesize=100&tagged=javascript Page through the results until has_more ...


1

Yes, much of the time, but: Do not assume this is so, since it is never explicitly promised. Some sortable routes do not even have an activity property (Example). In this answer, the lead API developer says: ... ordering is descending by default. This question and answer imply (but do not guarantee) that data is sorted by activity, by default (if ...


1

Use the /questions path and sort by: creation, desc. For example:     /2.1/questions?pagesize=15&order=desc&sort=creation&tagged=php&site=stackoverflow


1

No, this is not currently available. It is currently not slated for the next API release either... I'll look into what it would take to get it added though. If it's not too rough it might make it into V2. Time was found to implement this, and it's been deployed.


Only top voted, non community-wiki answers of a minimum length are eligible