I have been experimenting with AWS API gateway service. I wanted to give default values to some of the parameters in the method request. However I couldn't find any option to do so. Is there any way to do that from the interface provided ?
You can set a static (i.e. a default/constant) value by using single quotes in the Integration Request mapping.
From the documentation at http://docs.aws.amazon.com/apigateway/latest/developerguide/request-response-data-mappings.html
The STATIC_VALUE is a string literal and must be enclosed within a pair of single quotes.
I took me a moment to find a good example of this, below are links to more documentation.
Doc Example:
Replace 'parameter-name' with the key and static-value with the value of your static key value pair to add the static param to the request headers.
"responseParameters": {
"integration.request.header.parameter-name": "'static value'"
}
CDK Example
const lambdaIntegration = new apigateway.LambdaIntegration(lambdaEndpoint, {
proxy: true,
requestParameters: {
"integration.request.header.parameter-name": "'static value'"
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With