Skip to content

Instantly share code, notes, and snippets.

@nicdev
Last active July 29, 2019 13:20
Show Gist options
  • Select an option

  • Save nicdev/28994c83969f9b3b45ca25ad3c36e58e to your computer and use it in GitHub Desktop.

Select an option

Save nicdev/28994c83969f9b3b45ca25ad3c36e58e to your computer and use it in GitHub Desktop.
swagger: '2.0'
info:
description: This is a demo Jukebox server for the NCR Unconference
version: 1.0.0
title: NCR Tunes
contact:
email: nic.rosental@tinroofsoftware.com
license:
name: Apache 2.0
url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
host: 'localhost:8080'
basePath: /v1
tags:
- name: songs
description: Rocking tunes for NCR peeps
externalDocs:
description: Find out more
url: 'http://localhost:8080/docs'
schemes:
- http
paths:
/songs:
get:
summary: List all songs in the jukebox
operationId: list
tags:
- songs
parameters:
- name: limit
in: query
description: How many items to return at one time (max 100)
required: false
type: integer
format: int32
responses:
'200':
description: An array of songs
headers:
x-next:
type: string
description: A link to the next page of responses
schema:
$ref: '#/definitions/Songs'
post:
tags:
- songs
summary: Add a new song to the jukebox
description: ''
operationId: addSong
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: body
description: Song object that needs to be added to the jukebox
required: true
schema:
$ref: '#/definitions/Song'
responses:
'200':
description: Song added to jukebox
'400':
description: Bad request
put:
tags:
- songs
summary: Update an existing song
description: Updates any property of an existing song based on ID passed
operationId: updateSong
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: body
description: Song object that needs to be updated in the jukebox
required: true
schema:
$ref: '#/definitions/Song'
responses:
'400':
description: Bad request
'404':
description: Song not found
'/songs/{songId}':
get:
tags:
- songs
summary: Display song by ID
description: Returns a single song
operationId: getSong
produces:
- application/json
parameters:
- name: songId
in: path
description: ID of song to return
required: true
type: integer
format: int64
responses:
'200':
description: successful operation
schema:
$ref: '#/definitions/Song'
'400':
description: Invalid ID supplied
'404':
description: Song not found
delete:
tags:
- songs
summary: Deletes a song from the jukebox
description: ''
operationId: deleteSong
produces:
- application/json
parameters:
- name: songId
in: path
description: Song id to delete
required: true
type: integer
format: int64
responses:
'400':
description: Invalid ID supplied
'404':
description: Pet not found
definitions:
Song:
type: object
required:
- name
- duration
properties:
id:
type: integer
format: int64
name:
type: string
example: Light My Fire
duration:
type: string
example: '6:33'
Songs:
type: array
items:
$ref: '#/definitions/Song'
externalDocs:
description: Find out more about Tin Roof
url: 'http://tinroofsoftware.com'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment