2

I'm using the proxy integration with my Java lambda function. The input for the lambda handler is a JSON object that represents an incoming request. It has a body, headers, query params and so on. But it doesn't include the source URL that is parsed by the API Gateway for the body, query params and etc. Is there a way to get it?

The thing is API Gateway doesn't support arrays in query parameters. Example: /endpoint?numbers=1&numbers=2. Seems, the only way to pass an array is to pass it as a JSON array string /endpoint?numbers=[1,2] but it is not always suitable. So I want to parse the URL by myself.

1
  • Has this changed at all, or has anyone found a way to get the full URL since this was posted?
    – manihiki
    Commented Aug 4, 2020 at 18:24

3 Answers 3

3

Unfortunately, API Gateway doesn't provide you with the full URL for you to parse yourself.

If you have the option of using the POST method to /endpoint, you might consider sending a request body instead of query string parameters.

1
  • Has this changed at all, or has anyone found a way to get the full URL?
    – manihiki
    Commented Aug 4, 2020 at 18:24
0

The 'path' field inside the 'requestContext' field contains the path of API gateway resource. See docs for more details.

1
  • The "path" value does not include the query params portion of the request url. Commented Sep 6, 2019 at 18:02
0

you can inject the UriInfo object. It holds all the information you need.

@Context
UriInfo uri;

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.