I'm using an API gateway that acts as a proxy API between my client and a third-party API. The third-party API accepts dynamic query param values that I need to forward from my proxy API.
So, I've set up an API gateway with path variables and integrated it into an HTTP URI(third-party API). There are only GET requests.
For further clarification, let's take an example.
I'm making a GET request to my API gateway endpoint which has the below format:
https://abcxyz.ap-southeast-3.amazonaws.com/api/{search}
As we can see the path variable here is search.
And I want to forward this search value to the integrated HTTP URI, which is defined as follows:
https://api.third-party/?apiKey=SECRET_KEY&s={search}
But now, the {search} dynamic part in the target endpoint is not substituted with the actual value. Instead, the request is directly sent as https://api.third-party/?apiKey=SECRET_KEY&s={search}.
How do I pass the path variable value to the integrated URI? Have tried several approaches including adding a parameter mapping, but nothing's worked out and also went through other similar questions but nothing helped. Maybe I'm following a wrong convention that I'm entirely not sure of. Any help is greatly appreciated.
Note: I do not want to use an extra lambda function that'll capture the incoming request and send the correct request to the target endpoint, as I feel it is overkill.
Thanks in Advance
So I was able to fix this issue. The trick is to add only the domain in the target URI, and the rest of the path along with the query parameters in the parameter mapping. I've written a detailed article along with the possible caveats along with images.
E.g: The target URI should look something like this: http://api.musixmatch.com/
The parameter mapping should contain what parts of the URI should be overwritten or appended and with what values.
I've written a detailed article demonstrating how to go about this along with images and possible caveats. You can read the article here.