Last active
May 2, 2016 01:33
-
-
Save degt/82731f14d5d9a08ff94f995c120a640a to your computer and use it in GitHub Desktop.
Serverless API Rest templates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"_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