Skip to content

Instantly share code, notes, and snippets.

@wing328
Created September 18, 2016 10:10
Show Gist options
  • Save wing328/44a6cb6c899feda4c2bd44747e9dcbc8 to your computer and use it in GitHub Desktop.
Save wing328/44a6cb6c899feda4c2bd44747e9dcbc8 to your computer and use it in GitHub Desktop.
OpenAPI/Swagger spec for Hacker News API
{
"swagger": "2.0",
"info": {
"title": "Hacker News",
"description": "<p>Hacker News API</p>\n",
"version": "1.0.1"
},
"host": "hacker-news.firebaseio.com",
"basePath": "/v0",
"schemes": [
"https"
],
"paths": {
"/updates.json": {
"get": {
"tags": [
"HackerNews"
],
"summary": "Get the changed items and profiles",
"description": "Get the changed items and profiles",
"operationId": "get",
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/Updates"
}
}
},
"security": []
}
},
"/topstories.json": {
"get": {
"tags": [
"HackerNews"
],
"summary": "Returns the current top 100 stories.",
"description": "Returns the current top 100 stories.",
"operationId": "get_top_stories",
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"type": "integer",
"format": "int32"
}
}
}
},
"security": []
}
},
"/user/{id}.json": {
"get": {
"tags": [
"HackerNews"
],
"summary": "Users are identified by case-sensitive ids",
"description": "Users are identified by case-sensitive ids",
"operationId": "get_user",
"produces": [
"application/json"
],
"parameters": [
{
"name": "id",
"in": "path",
"description": "User ID",
"required": true,
"type": "string",
"x-example": "wing328hk"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/User"
}
}
},
"security": []
}
},
"/maxitem.json": {
"get": {
"tags": [
"HackerNews"
],
"summary": "Get the current largest item id",
"description": "Get the current largest item id",
"operationId": "get_max_item",
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "integer",
"format": "int32"
}
}
},
"security": []
}
},
"/item/{id}.json": {
"get": {
"tags": [
"HackerNews"
],
"summary": "Get the Item (story, comment, jobs, Ask HN, etc)",
"description": "Stories, comments, jobs, Ask HNs and even polls are just items. They're identified by their ids, which are unique integers.",
"operationId": "get_item",
"produces": [
"application/json"
],
"parameters": [
{
"name": "id",
"in": "path",
"description": "Item ID",
"required": true,
"type": "string",
"x-example": "10000"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/Item"
}
}
},
"security": []
}
}
},
"definitions": {
"Updates": {
"required": [
"items"
],
"properties": {
"items": {
"type": "array",
"items": {
"type": "integer"
}
},
"profiles": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"Item": {
"required": [
"by"
],
"properties": {
"by": {
"type": "string"
},
"id": {
"type": "integer",
"format": "int32"
},
"kids": {
"type": "integer",
"format": "int32"
},
"parent": {
"type": "integer",
"format": "int32"
},
"parts": {
"type": "integer",
"format": "int32"
},
"score": {
"type": "integer",
"format": "int32"
},
"text": {
"type": "string"
},
"time": {
"type": "integer",
"format": "int32"
},
"title": {
"type": "string"
},
"type": {
"type": "string"
},
"url": {
"type": "string"
}
}
},
"User": {
"required": [
"about"
],
"properties": {
"about": {
"type": "string",
"x-example": ""
},
"created": {
"type": "integer"
},
"delay": {
"type": "integer",
"x-example": "0"
},
"id": {
"type": "string",
"x-example": "wing328hk"
},
"karma": {
"type": "integer"
},
"submitted": {
"type": "array",
"items": {
"type": "integer"
}
}
}
}
},
"securityDefinitions": {},
"security": [],
"tags": [
{
"name": "Item",
"description": "Operations about Item"
},
{
"name": "Maxitem",
"description": "Operations about Maxitem"
},
{
"name": "Topstories",
"description": "Operations about Topstories"
},
{
"name": "Updates",
"description": "Operations about Updates"
},
{
"name": "User",
"description": "Operations about User"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment