Skip to content

Instantly share code, notes, and snippets.

@degt
Last active May 2, 2016 01:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save degt/82731f14d5d9a08ff94f995c120a640a to your computer and use it in GitHub Desktop.
Save degt/82731f14d5d9a08ff94f995c120a640a to your computer and use it in GitHub Desktop.
Serverless API Rest templates
{
"_comment": "Api Rest templates",
"restGet": {
"application/json": {
"method": "$context.httpMethod"
}
},
"restPost": {
"application/json": "{\n\"method\": \"$context.httpMethod\",\n\"body\": $input.json('$')\n}"
},
"restPut": {
"application/json": "{\n\"method\": \"$context.httpMethod\",\"body\": $input.json('$'),\"id\":\"$input.params('id')\"\n}"
},
"restDelete": {
"application/json": {
"method": "$context.httpMethod",
"id": "$input.params('id')"
}
},
"_comment": "Api Responses templates",
"responsesTemplate": {
".*\"status\":400.*": "$${status400}",
"default": "$${status200}"
},
"status400": {
"statusCode": "400",
"responseTemplates": {
"application/json;charset=UTF-8": "$input.path('$.errorMessage')"
}
},
"status200": {
"statusCode": "200",
"responseParameters": {},
"responseModels ": {
"application/json;charset=UTF-8": "Empty"
},
"responseTemplates": {
"application/json;charset=UTF-8": ""
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment