Stack Apps is a question and answer site for apps, scripts, and development with the Stack Exchange API. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to fetch questions one by one, starting from the latest, so that I can create an infinite stream of questions in a Clojure program. I haven't yet been able to do so.

I can't just get the latest question ID and go backwards, because they don't seem sequential. It might be possible with page and pagesize, but I can't figure out how.

share|improve this question
can you please elaborate on what you are attempting? there may be a better way to accomplish it. – Sky Sanders Aug 20 '10 at 15:01
I am trying to create an "infinite" stream of questions in my clojure program so i can do "(take 5 questions)" – Surya Aug 20 '10 at 15:27
up vote 3 down vote accepted

that depends on what you mean by 'latest'.

do you mean latest created or latest activity?

in either case, if you truly want to fetch questions one at a time use pagesize=1 and increment page for each request.

Please see notes following this direct answer to your question:

  "total": 879963,
  "page": 1,
  "pagesize": 1,
  "questions": [
      "tags": [
      "answer_count": 0,
      "favorite_count": 0,
      "question_timeline_url": "/questions/3532035/timeline",
      "question_comments_url": "/questions/3532035/comments",
      "question_answers_url": "/questions/3532035/answers",
      "question_id": 3532035,
      "owner": {
        "user_id": 426462,
        "user_type": "unregistered",
        "display_name": "enigma",
        "reputation": 1,
        "email_hash": "01a90fc7976ab9b51d143a9da42c8153"
      "creation_date": 1282315993,
      "last_activity_date": 1282315993,
      "up_vote_count": 0,
      "down_vote_count": 0,
      "view_count": 0,
      "score": 0,
      "community_owned": false,
      "title": "multi field widget - format in symfony backend"

  "total": 879966,
  "page": 2,
  "pagesize": 1,
  "questions": [
      "tags": [
      "answer_count": 0,
      "favorite_count": 1,
      "question_timeline_url": "/questions/3532038/timeline",
      "question_comments_url": "/questions/3532038/comments",
      "question_answers_url": "/questions/3532038/answers",
      "question_id": 3532038,
      "owner": {
        "user_id": 395126,
        "user_type": "registered",
        "display_name": "rmx",
        "reputation": 486,
        "email_hash": "e489b2b84bf5074bf675330343f93a1b"
      "creation_date": 1282316000,
      "last_activity_date": 1282316000,
      "up_vote_count": 1,
      "down_vote_count": 0,
      "view_count": 5,
      "score": 1,
      "community_owned": false,
      "title": "Correct use of C# properties"


Please be sure that fetching single records fits your use case properly. There are subtle issues that you will encounter when paging by 1 on the head of a temporally sorted dataset, especially one as large and active as the so database.

share|improve this answer
perfect!!!. thanks – Surya Aug 20 '10 at 14:59
@surya - my pleasure. if you have any other questions, please do ask. there are many here who are happy to provide many perspectives. – Sky Sanders Aug 20 '10 at 15:03

You must log in to answer this question.

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