Hacker News Review

Hacker News Review · Acciones GPT

Hacker News API v0

Access to Hacker News data in near real time.

  • GET /item/{id}.jsonGet item by ID

    Retrieves an item by its unique ID.

  • GET /topstories.jsonGet top stories

    Retrieves an array of IDs for the top stories.

Esquema original API
{
  "openapi": "3.0.0",
  "info": {
    "title": "Hacker News API v0",
    "description": "Access to Hacker News data in near real time.",
    "version": "0.1"
  },
  "servers": [
    {
      "url": "https://hacker-news.firebaseio.com/v0/"
    }
  ],
  "paths": {
    "/item/{id}.json": {
      "get": {
        "summary": "Get item by ID",
        "operationId": "getItem",
        "description": "Retrieves an item by its unique ID.",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "integer"
            },
            "required": true,
            "description": "Unique identifier of the item."
          }
        ],
        "responses": {
          "200": {
            "description": "An item object.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Item"
                }
              }
            }
          }
        }
      }
    },
    "/topstories.json": {
      "get": {
        "summary": "Get top stories",
        "operationId": "getTopStories",
        "description": "Retrieves an array of IDs for the top stories.",
        "responses": {
          "200": {
            "description": "An array of top story IDs.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "integer"
                  },
                  "example": [
                    9129911,
                    9129199
                  ]
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Item": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "The item's unique id."
          },
          "deleted": {
            "type": "boolean",
            "description": "true if the item is deleted."
          },
          "type": {
            "type": "string",
            "description": "The type of item."
          },
          "by": {
            "type": "string",
            "description": "The username of the item's author."
          },
          "time": {
            "type": "integer",
            "description": "Creation date of the item, in Unix Time."
          },
          "text": {
            "type": "string",
            "description": "The comment, story or poll text. HTML."
          },
          "dead": {
            "type": "boolean",
            "description": "true if the item is dead."
          },
          "parent": {
            "type": "integer",
            "description": "The comment's parent ID."
          },
          "kids": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "The ids of the item's comments, in ranked display order."
          },
          "url": {
            "type": "string",
            "description": "The URL of the story."
          },
          "score": {
            "type": "integer",
            "description": "The story's score, or the votes for a pollopt."
          },
          "title": {
            "type": "string",
            "description": "The title of the story, poll or job. HTML."
          },
          "parts": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "description": "A list of related pollopts, in display order."
          },
          "descendants": {
            "type": "integer",
            "description": "In the case of stories or polls, the total comment count."
          }
        }
      }
    }
  }
}