4 Home
kogir edited this page 2014-10-04 02:58:47 -07:00

Hacker News API

Overview

Publicly visible HN data is now available in near real time via Firebase. Firebase enables easy access for Android, iOS and web apps, and even REST clients. Their uptime might be better than ours too.

The data lives at https://hacker-news.firebaseio.com in the format described below.

Format

Right now, only the publicly visible properties of user profiles, stories, and comments are available. These are surfaced in the API as users and items. Since this is the first release of the API, everything is rooted at the v0 node in the HN Firebase. This should allow for rolling upgrades should the schema ever change.

Items

Stories, comments, and even polls are just items. They're identified by their IDs, which are unique integers. For example, item 9544

{
  "v0": {
    "item" : {
      "9544": {
        "by": "kogir",
        "id": 9544,
        "parent": 8258,
        "time": 1175847757,
        "type": "comment",
        "text": "This is far from new, but it is a problem.  Ironically, the old
                 school SOAP 1.1 way of doing things (with a header and a post)
                 is immune from this.  <p>Also, correct me if I'm wrong, but isn't
                 JSON and the script tag way of calling things explicitly designed
                 to DEFEAT the same origin policy?  If the entire point of your
                 data transfer method is to make it possible for anyone to request
                 your data, you should only send data that everyone should be able
                 to see =P\n"
      }
    },
    "topstories": [8402079,8402859 ... 8400517],
    "user": {
    "id": "kogir",
    "delay": 0,
    "created": 1175847739,
    "karma": 4448,
    "about": "Interested in computer security and privacy. Likes hardware hacking,
              orchids, and good sci-fi books.<p>I work at YC on Hacker News (and
              other things). Work email is my first name (nick) at work domain
              (ycombinator.com). Personal email is my first name (nick) at my
              username (kogir) .com",
    "submitted": [8399180,8349660,8349526 ... 9544]
    }
  }
}

Items

Nearly every piece of content on HN is an item, including stories, comments, polls, and poll-options.

deleted: id deleted comment: id type by time text dead parent kids story: id type by time text dead parent kids url title parts