1

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

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

I was trying out {proxy+} option thinking that it would work, but it did not work for HTTP URI. Thanks for the article. It was helpful
@GaneshKumar I'm glad the article could help you in fixing the issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.