Skip to content

AWS Api Gateway integration url

0

I am using AWS Api Gateway and i would like to write some tests. Specifically i have an endpoint where i do some request mapping to generate the integration url and add additional query params and also resolve path params. I'd like to return that url in a response header so my test can verify that the correct api url is sent to the backend. Is there a way to do this?

asked 2 years ago452 views

1 Answer
0

From the question it is not very clear, therefore I am asking this - Are you trying to create the Integration URL using the mapping template and wish to pass it to the backend service or modify the Endpoint URL parameter of the API method and return that URL to the caller.

Some of the points that needs to be considered are:

  1. You can build the Integration URL in the mapping templates using path parameters, query string parameters and headers but cannot assign this value to the API method integration URL. You can either pass this value to the backend service in form of body or headers/querystring/path parameters or by overiding the request params.

[+] https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-override-request-response-parameters.html

  1. By default, we can only map the method request parameters to integration request parameters which is sent to backend service. Similarly, we can map only the integration response data which is returned by backend service to method response headers which would be passed to the invoker/caller. There is no direct way where we can set the integration request parameters to the method response/integration response resources to return to the API Gateway invoker.

  2. If the created Integration URL is returned from the backend response, then you can map the integration response data to method response data using the mapping template configured on Integration response settings. Please refer to this article:

[+] https://docs.aws.amazon.com/apigateway/latest/developerguide/request-response-data-mappings.html

If my understanding is wrong and you are use-case is different, then can you please provide detailed information and some more details on what you want to achieve.

AWS

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.