{
  "basePath": "/",
  "definitions": {
    "Choice": {},
    "Polls API Root": {},
    "Question": {},
    "Questions Collection": {}
  },
  "host": "polls.apiblueprint.org",
  "info": {
    "description": "Polls is a simple API allowing consumers to view polls and vote in them. You can view this documentation over at [Apiary](http://docs.pollsapi.apiary.io).",
    "title": "Polls",
    "version": ""
  },
  "paths": {
    "/": {
      "get": {
        "description": "",
        "parameters": [],
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "examples": {
              "application/json": {
                "questions_url": "/questions"
              }
            },
            "headers": {}
          }
        },
        "summary": "Retrieve the Entry Point",
        "tags": []
      }
    },
    "/questions": {
      "get": {
        "description": "",
        "parameters": [
          {
            "description": "The page of questions to return",
            "in": "query",
            "name": "page",
            "required": false,
            "type": "number",
            "x-example": "1"
          }
        ],
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "examples": {
              "application/json": [
                {
                  "choices": [
                    {
                      "choice": "Swift",
                      "url": "/questions/1/choices/1",
                      "votes": 2048
                    },
                    {
                      "choice": "Python",
                      "url": "/questions/1/choices/2",
                      "votes": 1024
                    },
                    {
                      "choice": "Objective-C",
                      "url": "/questions/1/choices/3",
                      "votes": 512
                    },
                    {
                      "choice": "Ruby",
                      "url": "/questions/1/choices/4",
                      "votes": 256
                    }
                  ],
                  "published_at": "2014-11-11T08:40:51.620Z",
                  "question": "Favourite programming language?",
                  "url": "/questions/1"
                }
              ]
            },
            "headers": {}
          }
        },
        "summary": "List All Questions",
        "tags": [
          "Question"
        ]
      },
      "post": {
        "description": "You may create your own question using this action. It takes a JSON object containing a question and a collection of answers in the form of choices.\n\n+ question (string) - The question\n\n+ choices (array[string]) - A collection of choices.",
        "parameters": [
          {
            "description": "The page of questions to return",
            "in": "query",
            "name": "page",
            "required": false,
            "type": "number",
            "x-example": "1"
          },
          {
            "in": "body",
            "name": "body",
            "schema": {
              "example": {
                "choices": [
                  "Swift",
                  "Python",
                  "Objective-C",
                  "Ruby"
                ],
                "question": "Favourite programming language?"
              },
              "properties": {
                "choices": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "question": {
                  "type": "string"
                }
              },
              "type": "object"
            }
          }
        ],
        "produces": [
          "application/json"
        ],
        "responses": {
          "201": {
            "description": "Created",
            "examples": {
              "application/json": {
                "choices": [
                  {
                    "choice": "Swift",
                    "url": "/questions/2/choices/1",
                    "votes": 0
                  },
                  {
                    "choice": "Python",
                    "url": "/questions/2/choices/2",
                    "votes": 0
                  },
                  {
                    "choice": "Objective-C",
                    "url": "/questions/2/choices/3",
                    "votes": 0
                  },
                  {
                    "choice": "Ruby",
                    "url": "/questions/2/choices/4",
                    "votes": 0
                  }
                ],
                "published_at": "2014-11-11T08:40:51.620Z",
                "question": "Favourite programming language?",
                "url": "/questions/2"
              }
            },
            "headers": {}
          }
        },
        "summary": "Create a New Question",
        "tags": [
          "Question"
        ]
      }
    },
    "/questions/{question_id}": {
      "get": {
        "description": "",
        "parameters": [
          {
            "description": "ID of the Question in form of an integer",
            "in": "path",
            "name": "question_id",
            "required": true,
            "type": "number",
            "x-example": "1"
          }
        ],
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "examples": {
              "application/json": {
                "choices": [
                  {
                    "choice": "Swift",
                    "url": "/questions/1/choices/1",
                    "votes": 2048
                  },
                  {
                    "choice": "Python",
                    "url": "/questions/1/choices/2",
                    "votes": 1024
                  },
                  {
                    "choice": "Objective-C",
                    "url": "/questions/1/choices/3",
                    "votes": 512
                  },
                  {
                    "choice": "Ruby",
                    "url": "/questions/1/choices/4",
                    "votes": 256
                  }
                ],
                "published_at": "2014-11-11T08:40:51.620Z",
                "question": "Favourite programming language?",
                "url": "/questions/1"
              }
            },
            "headers": {}
          }
        },
        "summary": "View a Questions Detail",
        "tags": [
          "Question"
        ]
      }
    },
    "/questions/{question_id}/choices/{choice_id}": {
      "post": {
        "description": "This action allows you to vote on a question's choice.",
        "parameters": [
          {
            "description": "ID of the Question in form of an integer",
            "in": "path",
            "name": "question_id",
            "required": true,
            "type": "number",
            "x-example": "1"
          },
          {
            "description": "ID of the Choice in form of an integer",
            "in": "path",
            "name": "choice_id",
            "required": true,
            "type": "number",
            "x-example": "1"
          }
        ],
        "responses": {
          "201": {
            "description": "Created",
            "examples": {},
            "headers": {}
          }
        },
        "summary": "Vote on a Choice",
        "tags": [
          "Question"
        ]
      }
    }
  },
  "schemes": [
    "http"
  ],
  "swagger": "2.0",
  "tags": [
    {
      "description": "Resources related to questions in the API.",
      "name": "Question"
    }
  ]
}
