I want to pass the generic request body while making API call through WebClient. I have dynamic key-value pairs in the database like (key1-value1, key2-value2, key3-value3). This key-value may grow or shrink.
Is there any way to call API with dynamic data with the JSON request body?
webClient.post().uri(uri).header(CONTENT_TYPE, APPLICATION_JSON)
.body({DYANAMIC JSON}).retrieve().onStatus(HttpStatus::isError, clientResponse -> {
return Mono.error(new Exception("error"));
}).bodyToMono(String.class);
Thank you