#Spring URI Builder WebClient

3 messages · Page 1 of 1 (latest)

dusty cosmos
#

I am trying to pass in a value to a endpoint to retrieve information based on another endpoint. Currently this is my method for the endpoint which has a value passed into it:

public OrderRoot getOrder(String orderNumber, int skip) {
        return webClient
                .get()
                .uri(uriBuilder -> uriBuilder
                        .path("/order/get")
                        .queryParam("selector", "{\"order_number\":\"" + orderNumber + "\"}")
                        .queryParam("limit", 100)
                        .queryParam("skip", skip)
                        .build())
                .header(auth, skuT + token)
                .retrieve()
                .bodyToMono(OrderRoot.class)
                .block();
    }```

In theory, this should print out as:
`/order/get?selector={"order_number":"E000"}`
where `E000` is the value being passed in. But I seem to be running into this error:

`There was an exception while trying to navigate to 'searchbydate' with the root cause 'java.lang.IllegalArgumentException: Not enough variable values available to expand '"order_number"''`
latent thornBOT
#

This post has been reserved for your question.

Hey @dusty cosmos! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.