I'm sending the following request to Spring Boot application deployed as AWS lambda function:
GET https://my-dev-host.com/fdx/v6/accounts?accountIds=confUser_1&accountIds=confUser_2&accountIds=confUser_3&accountIds=confUser_4&offset=1&limit=3
Authorization: Bearer ....
Accept: application/json
Accept-Charset: UTF-8
Content-Type: application/json
But int the log I see that only the last accountId
is actually arrives into controller:
Modified request:
{
"multiValueQueryStringParameters": {
"accountIds": [
"confUser_4"
],
"limit": [
"3"
],
"offset": [
"1"
]
},
"queryStringParameters": {
"accountIds": "confUser_4",
"limit": "3",
"offset": "1"
},
"multiValueHeaders": {
"accept": [
"application/json"
],
"accept-charset": [
"UTF-8"
],
"accept-encoding": [
"br, deflate, gzip, x-gzip"
],
"authorization": [
"Bearer ..."
],
"content-type": [
"application/json"
],
"host": [
"my-dev-host.com"
]
},
"headers": {
"accept": "application/json",
"accept-charset": "UTF-8",
"accept-encoding": "br, deflate, gzip, x-gzip",
"authorization": "Bearer ...",
"content-type": "application/json",
"host": "my-dev-host.com"
},
"pathParameters": {},
"httpMethod": "GET",
"stageVariables": {},
"path": "/fdx/v6/accounts",
"isBase64Encoded": false,
"requestSource": "ALB"
}
I've tried to modify request as
GET https://my-dev-host.com/fdx/v6/accounts?accountIds=confUser_1&,confUser_2,confUser_3,confUser_4&offset=1&limit=3
Authorization: Bearer ....
Accept: application/json
Accept-Charset: UTF-8
Content-Type: application/json
But still no luck.
Here is the API of my controller:
@RequestMapping(
method = RequestMethod.GET,
value = "/accounts",
produces = {"application/json"}
)
ResponseEntity<Object> searchForAccounts(
@Parameter(name = "accountIds", description = "Comma separated list of account ids", in = ParameterIn.QUERY) @Valid @RequestParam(value = "accountIds", required = false) List<String> accountIds,
@Parameter(name = "offset", description = "Opaque cursor used by the provider to send the next set of records", in = ParameterIn.QUERY) @Valid @RequestParam(value = "offset", required = false) String offset,
@Parameter(name = "limit", description = "Number of elements that the consumer wishes to receive. Providers should implement reasonable default and maximum values", in = ParameterIn.QUERY) @Valid @RequestParam(value = "limit", required = false) Integer limit
);
I believe the way API gateway maps the query parameters you need to comma separate your accountIds
. Aka https://my-dev-host.com/fdx/v6/accounts?accountIds=confUser_1,confUser_2,confUser_3,confUser_4&offset=1&limit=3