Skill 1.1.6

Create, extend, and maintain APIs (for example, response/request transformations, enforcing validation rules, overriding status codes)

Key Concepts

REST APIs support request validation: you attach a validator to a method to check required query strings and headers and to validate the request body against a JSON Schema model. Invalid requests are rejected with a 400 error before your backend is invoked, saving cost and code.

With a non-proxy integration, mapping templates written in Velocity Template Language transform the request into the format the backend expects and transform the backend response for the client. Integration responses map backend results to method responses, which is how you override status codes, for example matching an error message pattern and returning 404 instead of 200. Gateway responses customise the errors API Gateway itself returns, such as adding CORS headers to 4xx and 5xx responses.