GitHub Raw JSON API

aws / serverless-application-model

9,560 Python

The AWS Serverless Application Model (AWS SAM) transform is a AWS CloudFormation macro that transforms SAM templates into CloudFormation templates.

sam-integ-PetStore Specification

Located in integration/resources/code/swagger1.json on branch HEAD

2.0 JSON 3 Endpoints 10.5 KB

Operations & Route Endpoints (8)

GET /
OPTIONS /
POST /
GET /pets
OPTIONS /pets
POST /pets
GET /pets/{petId}
OPTIONS /pets/{petId}
Raw JSON Specification
{
  "definitions": {
    "Empty": {
      "type": "object"
    }
  },
  "info": {
    "description": "Your first API with Amazon API Gateway. This is a sample API that integrates via HTTP with our demo Pet Store endpoints",
    "title": "sam-integ-PetStore"
  },
  "paths": {
    "/": {
      "get": {
        "consumes": [
          "application/json"
        ],
        "produces": [
          "text/html"
        ],
        "responses": {
          "200": {
            "description": "200 response",
            "headers": {
              "Content-Type": {
                "type": "string"
              }
            }
          }
        },
        "x-amazon-apigateway-integration": {
          "requestTemplates": {
            "application/json": "{\"statusCode\": 200}"
          },
          "responses": {
            "default": {
              "responseParameters": {
                "method.response.header.Content-Type": "'text/html'"
              },
              "responseTemplates": {
                "text/html": "<html>\n    <head>\n        <style>\n        body {\n            color: #333;\n            font-family: Sans-serif;\n            max-width: 800px;\n            margin: auto;\n        }\n        </style>\n    </head>\n    <body>\n        <h1>Welcome to your Pet Store API</h1>\n        <p>\n            You have succesfully deployed your first API. You are seeing this HTML page because the <code>GET</code> method to the root resource of your API returns this content as a Mock integration.\n        </p>\n        <p>\n            The Pet Store API contains the <code>/pets</code> and <code>/pets/{petId}</code> resources. By making a <a href=\"/$context.stage/pets/\" target=\"_blank\"><code>GET</code> request</a> to <code>/pets</code> you can retrieve a list of Pets in your API. If you are looking for a specific pet, for example the pet with ID 1, you can make a <a href=\"/$context.stage/pets/1\" target=\"_blank\"><code>GET</code> request</a> to <code>/pets/1</code>.\n        </p>\n        <p>\n            You can use a REST client such as <a href=\"https://www.getpostman.com/\" target=\"_blank\">Postman</a> to test the <code>POST</code> methods in your API to create a new pet. Use the sample body below to send the <code>POST</code> request:\n        </p>\n        <pre>\n{\n    \"type\" : \"cat\",\n    \"price\" : 123.11\n}\n        </pre>\n    </body>\n</html>"
              },
              "statusCode": "200"
            }
          },
          "type": "mock"
        }
      },
      "options": {
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "200 response",
            "headers": {
              "Access-Control-Allow-Headers": {
                "type": "string"
              },
              "Access-Control-Allow-Methods": {
                "type": "string"
              },
              "Access-Control-Allow-Origin": {
                "type": "string"
              }
            },
            "schema": {
              "$ref": "#/definitions/Empty"
            }
          }
        },
        "x-amazon-apigateway-integration": {
          "requestTemplates": {
            "application/json": "{\"statusCode\": 200}"
          },
          "responses": {
            "default": {
              "responseParameters": {
                "method.response.header.Access-Control-Allow-Headers": "'Content-Type,X-Amz-Date,Authorization,X-Api-Key'",
                "method.response.header.Access-Control-Allow-Methods": "'POST,OPTIONS'",
                "method.response.header.Access-Control-Allow-Origin": "'*'"
              },
              "statusCode": "200"
            }
          },
          "type": "mock"
        }
      },
      "post": {
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "200 response",
            "headers": {
              "Access-Control-Allow-Origin": {
                "type": "string"
              }
            },
            "schema": {
              "$ref": "#/definitions/Empty"
            }
          }
        },
        "x-amazon-apigateway-integration": {
          "httpMethod": "POST",
          "responses": {
            "default": {
              "responseParameters": {
                "method.response.header.Access-Control-Allow-Origin": "'*'"
              },
              "statusCode": "200"
            }
          },
          "type": "http",
          "uri": "http://petstore-demo-endpoint.execute-api.com/petstore/pets"
        }
      }
    },
    "/pets": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "type",
            "required": false,
            "type": "string"
          },
          {
            "in": "query",
            "name": "page",
            "required": false,
            "type": "string"
          }
        ],
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "200 response",
            "headers": {
              "Access-Control-Allow-Origin": {
                "type": "string"
              }
            },
            "schema": {
              "$ref": "#/definitions/Empty"
            }
          }
        },
        "x-amazon-apigateway-integration": {
          "httpMethod": "GET",
          "requestParameters": {
            "integration.request.querystring.page": "method.request.querystring.page",
            "integration.request.querystring.type": "method.request.querystring.type"
          },
          "responses": {
            "default": {
              "responseParameters": {
                "method.response.header.Access-Control-Allow-Origin": "'*'"
              },
              "statusCode": "200"
            }
          },
          "type": "http",
          "uri": "http://petstore-demo-endpoint.execute-api.com/petstore/pets"
        }
      },
      "options": {
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "200 response",
            "headers": {
              "Access-Control-Allow-Headers": {
                "type": "string"
              },
              "Access-Control-Allow-Methods": {
                "type": "string"
              },
              "Access-Control-Allow-Origin": {
                "type": "string"
              }
            },
            "schema": {
              "$ref": "#/definitions/Empty"
            }
          }
        },
        "x-amazon-apigateway-integration": {
          "requestTemplates": {
            "application/json": "{\"statusCode\": 200}"
          },
          "responses": {
            "default": {
              "responseParameters": {
                "method.response.header.Access-Control-Allow-Headers": "'Content-Type,X-Amz-Date,Authorization,X-Api-Key'",
                "method.response.header.Access-Control-Allow-Methods": "'POST,GET,OPTIONS'",
                "method.response.header.Access-Control-Allow-Origin": "'*'"
              },
              "statusCode": "200"
            }
          },
          "type": "mock"
        }
      },
      "post": {
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "200 response",
            "headers": {
              "Access-Control-Allow-Origin": {
                "type": "string"
              }
            },
            "schema": {
              "$ref": "#/definitions/Empty"
            }
          }
        },
        "x-amazon-apigateway-integration": {
          "httpMethod": "POST",
          "responses": {
            "default": {
              "responseParameters": {
                "method.response.header.Access-Control-Allow-Origin": "'*'"
              },
              "statusCode": "200"
            }
          },
          "type": "http",
          "uri": "http://petstore-demo-endpoint.execute-api.com/petstore/pets"
        }
      }
    },
    "/pets/{petId}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "petId",
            "required": true,
            "type": "string"
          }
        ],
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "200 response",
            "headers": {
              "Access-Control-Allow-Origin": {
                "type": "string"
              }
            },
            "schema": {
              "$ref": "#/definitions/Empty"
            }
          }
        },
        "x-amazon-apigateway-integration": {
          "httpMethod": "GET",
          "requestParameters": {
            "integration.request.path.petId": "method.request.path.petId"
          },
          "responses": {
            "default": {
              "responseParameters": {
                "method.response.header.Access-Control-Allow-Origin": "'*'"
              },
              "statusCode": "200"
            }
          },
          "type": "http",
          "uri": "http://petstore-demo-endpoint.execute-api.com/petstore/pets/{petId}"
        }
      },
      "options": {
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "200 response",
            "headers": {
              "Access-Control-Allow-Headers": {
                "type": "string"
              },
              "Access-Control-Allow-Methods": {
                "type": "string"
              },
              "Access-Control-Allow-Origin": {
                "type": "string"
              }
            },
            "schema": {
              "$ref": "#/definitions/Empty"
            }
          }
        },
        "x-amazon-apigateway-integration": {
          "requestTemplates": {
            "application/json": "{\"statusCode\": 200}"
          },
          "responses": {
            "default": {
              "responseParameters": {
                "method.response.header.Access-Control-Allow-Headers": "'Content-Type,X-Amz-Date,Authorization,X-Api-Key'",
                "method.response.header.Access-Control-Allow-Methods": "'GET,OPTIONS'",
                "method.response.header.Access-Control-Allow-Origin": "'*'"
              },
              "statusCode": "200"
            }
          },
          "type": "mock"
        }
      }
    }
  },
  "schemes": [
    "https"
  ],
  "swagger": "2.0"
}