Issue: We could not decode your NextToken. Possible reasons include: a transmission error, improper quoting or a truncation problem error on hitting Amazon selling enpoint getOrders API with NextToken value
nextToken=iAYGXEyagd6aJqJYLDm0ZIfVkJJPpovRdryNqjfPaIgg9hUJsk3DPQwtlDeM2mghxqXyQLkGMBs8VhF73Xgy 0lC3mC1SzpGl5YHgZCa7BDKYu8QTdnkAITZqJeSW7tJInTAy XKVmRZBY oaVuyc8QON K1yc/Y6mKKWPJTYqxJASkEew64xp6vE53eCWYOf2GLmUGyr9UGnxD0RJmrryegoU0IPZxXDmflVin9AbefZ6iCRhULKp103vYt7V5hMBO/reDY2s8hGWNNu3VwFU0hrIUQcumUIIYkgmdzyCpNQzRAUqdu/jzY7WGQwHDOWh6eH2mzao0RSPB0n 5LC/yAULdxUEMyUhl2OGtBpE5P8rTgv6Pn3rcTR/rGtYbyw9WyW4t8nDBlt8msQODE5D/2DVeWLo9hEsqGJJJsu8 Pnp7zXB4uNQJUR5kP8q rofIA3nWZ0bLPZjTnVM/HGQ==iAYGXEyagd6aJqJYLDm0ZIfVkJJPpovRdryNqjfPaIgg9hUJsk3DPQwtlDeM2mghxqXyQLkGMBs8VhF73Xgy 0lC3mC1SzpGl5YHgZCa7BDKYu8QTdnkAITZqJeSW7tJInTAy XKVmRZBY oaVuyc8QON K1yc/Y6mKKWPJTYqxJASkEew64xp6vE53eCWYOf2GLmUGyr9UGnxD0RJmrryegoU0IPZxXDmflVin9AbefZ6iCRhULKp103vYt7V5hMBO/reDY2s8hGWNNu3VwFU0hrIUQcumUIIYkgmdzyCpNQzRAUqdu/jzY7WGQwHDOWh6eH2mzao0RSPB0n 5LC/yAULdxUEMyUhl2OGtBpE5P8rTgv6Pn3rcTR/rGtYbyw9WyW4t8nDBlt8msQODE5D/2DVeWLo9hEsqGJJJsu8 Pnp7zXB4uNQJUR5kP8q rofIA3nWZ0bLPZjTnVM/HGQ==
String uri = UriComponentsBuilder.fromHttpUrl(applicationConfig.getBaseURL() + applicationConfig.getOrdersApi())
.queryParam("CreatedAfter", "2017-01-20T19:49:35Z")
.queryParam("MarketplaceIds", "XXXXXX")
.queryParam("MaxResultsPerPage", request.getBatchSize())
.queryParam("NextToken", UriUtils.encode(nextTokenValue, StandardCharsets.UTF_8))
.build().toUri().toString();
restTemplate.setRequestFactory(clientHttpRequestFactory(tokenResponse));
restTemplate.exchange(uri, HttpMethod.GET, entity, AmazonSellingOrders.class);
I am trying to encode thhe nextToken with UriUtils.encode method. The value is encoded as expected then passed to the aws signer thorugh resTemplate exchange.
But keep on getting We could not decode your NextToken. Possible reasons include: a transmission error, improper quoting or a truncation problem error on hitting Amazon selling enpoint getOrders API with NextToken value org.springframework.web.client.HttpClientErrorException$BadRequest: 400 Bad Request: [{ "errors": [ { "message": null, "code": "InvalidInput" } ] }]
Any information/help appreciated.
Thanks