Skip to content

Instantly share code, notes, and snippets.

@bendavis78
Last active January 12, 2016 17:32
Show Gist options
  • Select an option

  • Save bendavis78/30ce03c928cf34072084 to your computer and use it in GitHub Desktop.

Select an option

Save bendavis78/30ce03c928cf34072084 to your computer and use it in GitHub Desktop.
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "All ATX",
"description": "under development",
"contact": {
"name": "Touch Titans",
"email": "info@touchtitans.com",
"url": "http://touchtitans.com"
}
},
"x-apigateway-api-id": "k0ykq5cjwa",
"host": "k0ykq5cjwa.execute-api.us-east-1.amazonaws.com",
"basePath": "/dev",
"schemes": [
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/bands": {
"x-lambda-function": "band",
"post": {
"tags": [
"bands"
],
"description": "Creates a band",
"operationId": "createBand",
"parameters": [
{
"name": "body",
"in": "body",
"description": "the band object",
"required": true,
"schema": {
"$ref": "#/definitions/band"
}
}
],
"responses": {
"200": {
"description": "the band was successfully created",
"schema": {
"$ref": "#/definitions/bandResource"
}
},
"400": {
"description": "validation error",
"schema": {
"$ref": "#/definitions/error"
}
},
"500": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/error"
}
}
}
}
},
"/bands/{urlName}": {
"x-lambda-function": "band",
"get": {
"tags": [
"bands"
],
"operationId": "getBand",
"description": "Returns band details",
"parameters": [
{
"name": "urlName",
"type": "string",
"in": "path",
"required": true,
"description": "unique URL name for the band, eg \"black-keys\""
}
],
"responses": {
"200": {
"description": "band object",
"schema": {
"$ref": "#/definitions/bandResource"
}
},
"404": {
"description": "not found",
"schema": {
"$ref": "#/definitions/error"
}
},
"500": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/error"
}
}
}
},
"put": {
"tags": [
"bands"
],
"description": "Creates or updates a band with the given urlName.",
"operationId": "putBand",
"parameters": [
{
"name": "urlName",
"type": "string",
"in": "path",
"required": true,
"description": "unique URL-name for the band, eg \"black-keys\""
},
{
"name": "body",
"in": "body",
"description": "the band object (all fields are required during PUT)",
"required": true,
"schema": {
"$ref": "#/definitions/band"
}
}
],
"responses": {
"200": {
"description": "the band was successfully created or updated",
"schema": {
"$ref": "#/definitions/bandResourcePut"
}
},
"400": {
"description": "validation error",
"schema": {
"$ref": "#/definitions/error"
}
},
"404": {
"description": "not found",
"schema": {
"$ref": "#/definitions/error"
}
},
"500": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/error"
}
}
}
},
"patch": {
"tags": [
"bands"
],
"description": "Updates the band with the given urlName.",
"operationId": "updateBand",
"parameters": [
{
"name": "urlName",
"type": "string",
"in": "path",
"required": true,
"description": "unique URL-name for the band, eg \"black-keys\""
},
{
"name": "body",
"in": "body",
"description": "an object containing properties to be updated",
"required": true,
"schema": {
"$ref": "#/definitions/band"
}
}
],
"responses": {
"200": {
"description": "the band was successfully updated",
"schema": {
"$ref": "#/definitions/bandResource"
}
},
"400": {
"description": "validation error",
"schema": {
"$ref": "#/definitions/error"
}
},
"404": {
"description": "not found",
"schema": {
"$ref": "#/definitions/error"
}
},
"500": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/error"
}
}
}
},
"delete": {
"tags": [
"bands"
],
"operationId": "deleteBand",
"description": "Deletes the band with the given urlName",
"parameters": [
{
"name": "urlName",
"type": "string",
"in": "path",
"required": true,
"description": "unique URL-name for the band, eg \"black-keys\""
}
],
"responses": {
"200": {
"description": "the band was successfully deleted"
},
"404": {
"description": "not found",
"schema": {
"$ref": "#/definitions/error"
}
},
"500": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/error"
}
}
}
}
},
"/venues": {
"x-lambda-function": "venue",
"post": {
"tags": [
"venues"
],
"description": "Creates a venue",
"operationId": "createVenue",
"responses": {
"200": {
"description": "the venue was successfully created",
"schema": {
"$ref": "#/definitions/venueResource"
}
},
"400": {
"description": "validation error",
"schema": {
"$ref": "#/definitions/error"
}
},
"500": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/error"
}
}
}
}
},
"/venues/{id}": {
"x-lambda-function": "venue",
"get": {
"tags": [
"venues"
],
"description": "Returns venue details",
"operationId": "getVendor",
"responses": {
"200": {
"description": "venue object",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/venueResource"
}
}
},
"500": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/error"
}
}
},
"parameters": [
{
"name": "id",
"type": "string",
"format": "uuid",
"in": "path",
"required": true,
"description": "unique URL name for the band, eg \"black-keys\""
}
]
},
"put": {
"tags": [
"venues"
],
"description": "Creates or updates a venue with the given id",
"operationId": "putVenue",
"parameters": [
{
"name": "id",
"type": "string",
"format": "uuid",
"in": "path",
"required": true,
"description": "venue id"
},
{
"name": "body",
"in": "body",
"description": "the venue object (all fields are required during PUT)",
"required": true,
"schema": {
"$ref": "#/definitions/venue"
}
}
],
"responses": {
"200": {
"description": "the venue was successfully created or updated",
"schema": {
"$ref": "#/definitions/venueResourcePut"
}
},
"400": {
"description": "validation error",
"schema": {
"$ref": "#/definitions/error"
}
},
"404": {
"description": "not found",
"schema": {
"$ref": "#/definitions/error"
}
},
"500": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/error"
}
}
}
},
"patch": {
"tags": [
"venues"
],
"description": "Updates the venue with the given id.",
"operationId": "updateVenue",
"parameters": [
{
"name": "id",
"type": "string",
"format": "uuid",
"in": "path",
"required": true,
"description": "Venue id"
},
{
"name": "body",
"in": "body",
"description": "an object containing properties to be updated",
"required": true,
"schema": {
"$ref": "#/definitions/band"
}
}
],
"responses": {
"200": {
"description": "the venue was successfully updated",
"schema": {
"$ref": "#/definitions/venueResource"
}
},
"400": {
"description": "validation error",
"schema": {
"$ref": "#/definitions/error"
}
},
"404": {
"description": "not found",
"schema": {
"$ref": "#/definitions/error"
}
},
"500": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/error"
}
}
}
},
"delete": {
"tags": [
"venues"
],
"operationId": "deleteVenue",
"description": "Deletes the venue with the given id",
"parameters": [
{
"name": "id",
"type": "string",
"format": "uuid",
"in": "path",
"required": true,
"description": "unique URL-name for the band, eg \"black-keys\""
}
],
"responses": {
"200": {
"description": "the band was successfully deleted"
},
"404": {
"description": "not found",
"schema": {
"$ref": "#/definitions/error"
}
},
"500": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/error"
}
}
}
}
}
},
"definitions": {
"band": {
"type": "object",
"required": [
"urlName",
"bandName",
"description",
"photo"
],
"properties": {
"urlName": {
"type": "string",
"pattern": "^[a-z0-9-]+$",
"maxLength": 50,
"description": "unique URL-name"
},
"bandName": {
"type": "string",
"description": "full band name"
},
"description": {
"type": "string",
"maxLength": 500,
"description": "a one-paragraph description of the band"
},
"photo": {
"type": "string",
"format": "uri",
"description": "URL to the band's photo"
},
"genre": {
"type": "string",
"maxLength": 50,
"description": "genre or list of genres"
},
"similarTo": {
"type": "string",
"description": "other bands that are similar"
},
"website": {
"type": "string",
"format": "uri",
"description": "band's website"
}
}
},
"bandResource": {
"properties": {
"url": {
"type": "string",
"format": "uri"
},
"data": {
"$ref": "#/definitions/band"
}
}
},
"bandResourcePut": {
"properties": {
"url": {
"type": "string",
"format": "uri"
},
"created": {
"type": "boolean"
},
"data": {
"$ref": "#/definitions/band"
}
}
},
"venue": {
"type": "object",
"required": [
"venueName",
"website",
"email",
"password"
],
"properties": {
"venueName": {
"type": "string"
},
"website": {
"type": "string",
"format": "uri"
},
"email": {
"type": "string",
"format": "email"
},
"password": {
"type": "string"
}
}
},
"venueResource": {
"properties": {
"url": {
"type": "string",
"format": "uri"
},
"data": {
"$ref": "#/definitions/venue"
}
}
},
"venueResourcePut": {
"properties": {
"url": {
"type": "string",
"format": "uri"
},
"created": {
"type": "boolean"
},
"data": {
"$ref": "#/definitions/venue"
}
}
},
"error": {
"type": "object",
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
}
}
}
},
"x-mapping-templates": {
"request": {
"application/json": "{\n \"body\" : $input.json('$'),\n \"method\": \"$context.httpMethod\",\n \"resourcePath\": \"$context.resourcePath\",\n \"headers\": {\n #foreach($header in $input.params().header.keySet())\n \"$header\": \"$util.escapeJavaScript($input.params().header.get($header))\" #if($foreach.hasNext),#end\n \n #end\n },\n \"params\": {\n #foreach($param in $input.params().path.keySet())\n \"$param\": \"$util.escapeJavaScript($input.params().path.get($param))\" #if($foreach.hasNext),#end\n \n #end\n },\n \"query\": {\n #foreach($queryParam in $input.params().querystring.keySet())\n \"$queryParam\": \"$util.escapeJavaScript($input.params().querystring.get($queryParam))\" #if($foreach.hasNext),#end\n \n #end\n } \n}\n"
},
"response": {
"errors": {
"application/json": "#set($error = $input.json('$.errorMessage'))\n#set($error = $error.replaceAll('\\\\(.)', '$1'))\n#set($error = $error.replaceAll('^\"|\"$', ''))\n#set($error = $error.replaceAll('\"status\":\\d+,?', ''))\n$error\n"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment