Skip to content

Instantly share code, notes, and snippets.

@rotemtam
Last active March 7, 2017 19:44
Show Gist options
  • Save rotemtam/ffe46ede1e90e8501a3c3daea2ad137d to your computer and use it in GitHub Desktop.
Save rotemtam/ffe46ede1e90e8501a3c3daea2ad137d to your computer and use it in GitHub Desktop.
api gateway swagger example
{
"swagger": "2.0",
"info": {
"version": "2017-02-26T12:58:40Z",
"title": "SampleProject"
},
"host": "<host_id>.execute-api.us-east-1.amazonaws.com",
"basePath": "/dev",
"schemes": [
"https"
],
"paths": {
"/repos/{id}": {
"post": {
// .. skipping some attributes for brevity
"x-amazon-apigateway-integration": {
// .. skipping more attributes for brevity
"credentials": "arn:aws:iam::<account number>:role/APIGatewayLambdaInvokeRole",
"requestTemplates": {
"application/json": "{\n \"method\": \"$context.httpMethod\",\n \"body\" : $input.json('$'),\n \"headers\": {\n #foreach($param in $input.params().header.keySet())\n \"$param\": \"$util.escapeJavaScript($input.params().header.get($param))\" #if($foreach.hasNext),#end\n \n #end\n },\n \"queryParams\": {\n #foreach($param in $input.params().querystring.keySet())\n \"$param\": \"$util.escapeJavaScript($input.params().querystring.get($param))\" #if($foreach.hasNext),#end\n \n #end\n },\n \"pathParams\": {\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 \"context\" : {\n \"gateway-request-id\" : \"$context.requestId\"\n }\n}"
},
"uri": "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:<account>:function:SampleProject_getRepositories/invocations",
"httpMethod": "POST",
"type": "aws"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment