AWS API Gateway Call, GET Call Issue

I am calling below the AWS Gateway API from a Java console application. At the postman, it works great with AWS signatures.

GET https://api.valorebooks.com/bid?isbns= [ "9780026840019"]

I am using the AWS SDK and this library. https://github.com/rpgreen/apigateway-generic-java-sdk

The console application passes the isbns parameter, but the API returns HTTP: 400

Source API: https://valorebooks.imtqy.com/api/source/bid/

+4
source share
2 answers

json

Map<String, String> parameters = new LinkedHashMap<>();
List<String> productsIsbs = Arrays.asList(request.getProducts())
                    .stream().map(x -> x.getIsbn()).collect(Collectors.toList());
String params = new Gson().toJson(productsIsbs).replace("\"", "\'");
parameters.put("isbns", params);

GenericApiGatewayRequest apiGatewayRequest;
        try {

            apiGatewayRequest = new GenericApiGatewayRequestBuilder()
                            .withHeaders(headers)
                            .withHttpMethod(HttpMethodName.GET)
                            .withResourcePath("/bid")
                            .withParameters(parameters)
                            .build();

            GenericApiGatewayApacheResponse response = client.executeGetWithHttpClient(apiGatewayRequest);

            if(response.getHttpResponse().getStatusLine().getStatusCode() == 200) {
                String responseJson = response.getBody();
            }

        } catch (GenericApiGatewayException e) {   // exception thrown for any non-2xx response
            System.out.println(String.format("Client exception:%s - %s", e.getStatusCode(), e.getMessage()));
            e.printStackTrace();
        }
0

GET, ?

https://api.valorebooks.com/bid?isbns=9780026840019

. API- .

-1

All Articles