How to use specific method with REST API resource?
** Which Category is your question related to? ** AWS Amplify REST API
** What AWS Services are you utilizing? ** AWS API Gateway, Lambda
** Provide additional details e.g. code snippets ** Hello, my question contains 2 parts since they are related:
- how can I limit my api resource to specific method only? Its not possible to choose GET only or GET & POST, resource always created with all method.
- how can I use API Gateway parameter validation with amplify?
@HumbleBeck
how can I limit my api resource to specific method only? Its not possible to choose GET only or GET & POST, resource always created with all method. currently api can be configured with CRUD operations. CREATE: POST READ: GET UPDATE: PUT, PATCH DELETE: DELETE those are the available options right now.
how can I use API Gateway parameter validation with amplify? In case you want to configure which query strings params or headers are allow, you need to edit those manually on the console.
We can mark this as feature requests
@HumbleBeck Alternatively, to unblock yourself now, you could edit the Cloudformation file in your amplify/backend/api/<resource-name>/ directory for this feature.
@kaustavghosh06 Thanks, I did in this way, but whenever you adding new resource via amplify api update, all your previous changes will be overwritten.
@HumbleBeck Yes, until we have in-built support for this in the CLI, you would have to manually manage the Cloudformation generated by the CLI for adding these fields.
Was this feature ever added?
In 2021 there still doesn't not appear to be a way to define a Rest API method, the default is "ANY" and editing the cloud-formation script runs the risk of it being overwritten.
This feature really needs to be implemented... I'd be okay with the inefficiencies of overkillingly creating all endpoints as ANY, but then you very quickly run into the Maximum policy size of 10240 bytes exceeded for role error after adding a handful of endpoints (when using in conjunction with Cognito); this means that for most applications actively utilising API gateway you have to keep manually modifying the CloudFormation template every time it's overwritten, which is ridiculous.
@Keydose We've fixed the issue tied to the "Maximum policy size 10240 bytes" - if you're using the latest version of the CLI. We're actively working on the overwriting of the CloudFormation file issue as well.
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.