2

I have some issues with passing array of parameters to query string for GET method, for example, /resource&item=1&item=2&item=3.

I have tried to pass parameters separated by commas and by &, it doesn`t work. How to configure API Gateway to do this? Can anyone help me?

1

3 Answers 3

2

Your example was using an ampersand (&) instead of a question mark (?) for separating the query string parameter from the path. I'm assuming that's just a typo.

Try passing the array using json syntax like

/resource?item=['1','2','3']

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

Comments

0

have you tried this way :

/resource&item[]=1&item[]=2&item[]=3

The way you used would erase the first data by the last data in the url.

4 Comments

The same problem, finally I got the last data
You shouldn't have to configure anything to make this work. This is standard HTTP request format. How are you fetching the datas ?
Their Known Issues docs.aws.amazon.com/apigateway/latest/developerguide/… states that you can't do this: Duplicated headers are not supported.
Duplicate query string parameters are not supported. Which is the OP's question.
0

What we are doing in our company is to pass data separated by ,. On Backend we explode the parameter and make it array again. I am not sure if there is more better way to do it or not. Let me know if you find any.

like ?items=1,2,3,4

And we get explode items with , through extra code

and get result as [1,2,3,4]

Comments

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.