Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS API Gateway: Pass through all parameters

I am using API Gateway in Amazon as a simple proxy to a backend api. The main reasons for using it are: a simple way to get API keys and authentication, tracking, and handling "environments".

My problem is that, we just want to pass through all query parameters, headers, etc. to our backend and let it handle it. Then on the way back, we'd like to pass back to the client the appropriate response code from our service; not have to explicitly map them. As I understand it, you pretty much have to specify every query parameter, and if the parameters change or you add more, you need to update your api. This is sort of tedious for us during dev/test.

Is there a way to tell Gateway to just accept and pass through any query parameters, headers, etc. so that you dont have to specify them explicitly? Same question for response Status codes?

like image 982
alph486 Avatar asked Apr 07 '16 18:04

alph486


People also ask

What is passthrough API gateway?

The process is known as integration passthrough. For proxy integrations, API Gateway passes the entire request through to your backend, and you do not have the option to modify the passthrough behaviors.

Does AWS API gateway automatically scale?

Amazon API Gateway will automatically scale to handle the amount of traffic your API receives.

How do I pass headers in API gateway?

To pass custom headers from an API Gateway API to a Lambda function, use a body mapping template. The API sends the updated API request to a Lambda function to process the headers. Then, the Lambda function returns one or more header values from the original API request.


1 Answers

Unfortunately no there is no way to do a passthrough of all parameters, you have to state each one in the method request. Same answer for status codes.

We've since launched the 'proxy' integration for HTTP endpoints and Lambda functions that will act as a proxy for the request input and send all parameters plus the payload to the integration. For Lambda functions, there is a prebuilt JSON structure that contains all parameters and the payload, as well as request context and stage variables.

See this doc: http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-set-up-simple-proxy.html#api-gateway-set-up-lambda-proxy-integration-on-proxy-resource

This is a feature request we've had in the past and it's on our backlog, but no ETA at this time. I'll take this as another +1 for both passthrough features.

like image 167
jackko Avatar answered Oct 22 '22 04:10

jackko