{ "swagger": "2.0", "info": { "description": "A simple Bookstore API example.", "title": "Bookstore", "version": "1.0.0" }, "host": "generated-bookstore.appspot.com", "basePath": "/", "consumes": [ "application/json" ], "produces": [ "application/json" ], "schemes": [ "https" ], "paths": { "/shelves": { "get": { "description": "Return all shelves in the bookstore.", "operationId": "listShelves", "produces": [ "application/json" ], "responses": { "200": { "description": "List of shelves in the bookstore.", "schema": { "$ref": "#/definitions/listShelvesResponse" } } }, "security": [ ] }, "post": { "description": "Create a new shelf in the bookstore.", "operationId": "createShelf", "parameters": [ { "description": "A shelf resource to create.", "in": "body", "name": "shelf", "required": true, "schema": { "$ref": "#/definitions/shelf" } } ], "produces": [ "application/json" ], "responses": { "200": { "description": "A newly created shelf resource.", "schema": { "$ref": "#/definitions/shelf" } } } }, "delete": { "description": "Delete all shelves.", "operationId": "deleteShelves", "responses": { "default": { "description": "An empty response body." } } } }, "/shelves/{shelf}": { "get": { "description": "Get a single shelf resource with the given ID.", "operationId": "getShelf", "parameters": [ { "description": "ID of the shelf to get.", "format": "int64", "in": "path", "name": "shelf", "required": true, "type": "integer" } ], "produces": [ "application/json" ], "responses": { "200": { "description": "A shelf resource.", "schema": { "$ref": "#/definitions/shelf" } }, "default": { "description": "unexpected error", "schema": { "$ref": "#/definitions/Error" } } } }, "delete": { "description": "Delete a single shelf with the given ID.", "operationId": "deleteShelf", "parameters": [ { "description": "ID of the shelf to delete.", "format": "int64", "in": "path", "name": "shelf", "required": true, "type": "integer" } ], "responses": { "default": { "description": "An empty response body." } } } }, "/shelves/{shelf}/books": { "get": { "description": "Return all books in a shelf with the given ID.", "operationId": "listBooks", "parameters": [ { "description": "ID of the shelf whose books should be returned.", "format": "int64", "in": "path", "name": "shelf", "required": true, "type": "integer" } ], "produces": [ "application/json" ], "responses": { "200": { "description": "List of books on the specified shelf.", "schema": { "$ref": "#/definitions/listBooksResponse" } }, "default": { "description": "unexpected error", "schema": { "$ref": "#/definitions/Error" } } } }, "post": { "description": "Create a new book on the shelf.", "operationId": "createBook", "parameters": [ { "description": "ID of the shelf where the book should be created.", "format": "int64", "in": "path", "name": "shelf", "required": true, "type": "integer" }, { "description": "Book to create.", "in": "body", "name": "book", "required": true, "schema": { "$ref": "#/definitions/book" } } ], "produces": [ "application/json" ], "responses": { "200": { "description": "A newly created book resource.", "schema": { "$ref": "#/definitions/book" } }, "default": { "description": "unexpected error", "schema": { "$ref": "#/definitions/Error" } } } } }, "/shelves/{shelf}/books/{book}": { "get": { "description": "Get a single book with a given ID from a shelf.", "operationId": "getBook", "parameters": [ { "description": "ID of the shelf from which to get the book.", "format": "int64", "in": "path", "name": "shelf", "required": true, "type": "integer" }, { "description": "ID of the book to get from the shelf.", "format": "int64", "in": "path", "name": "book", "required": true, "type": "integer" } ], "produces": [ "application/json" ], "responses": { "200": { "description": "A book resource.", "schema": { "$ref": "#/definitions/book" } }, "default": { "description": "unexpected error", "schema": { "$ref": "#/definitions/Error" } } } }, "delete": { "description": "Delete a single book with a given ID from a shelf.", "operationId": "deleteBook", "parameters": [ { "description": "ID of the shelf from which to delete the book.", "format": "int64", "in": "path", "name": "shelf", "required": true, "type": "integer" }, { "description": "ID of the book to delete from the shelf.", "format": "int64", "in": "path", "name": "book", "required": true, "type": "integer" } ], "responses": { "default": { "description": "An empty response body." } } } } }, "definitions": { "book": { "properties": { "author": { "type": "string" }, "name": { "type": "string" }, "title": { "type": "string" } }, "required": [ "name", "author", "title" ] }, "listBooksResponse": { "properties": { "books": { "items": { "$ref": "#/definitions/book" }, "type": "array" } }, "required": [ "books" ], "type": "object" }, "listShelvesResponse": { "properties": { "shelves": { "items": { "$ref": "#/definitions/shelf" }, "type": "array" } }, "type": "object" }, "shelf": { "properties": { "name": { "type": "string" }, "theme": { "type": "string" } }, "required": [ "name", "theme" ] }, "error": { "required": [ "code", "message" ], "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" } } } }, "security": [ { "api_key": [ ] } ], "securityDefinitions": { "api_key": { "in": "query", "name": "key", "type": "apiKey" } } }