Search code examples
springspring-bootwebclientspring-webclient

Sending a Json in get request in java


There is an API which sends back data on get request from a database. The database is huge, so the data we need, we have to specify it in json. So actually we have to send a json with get request to get back the desired data.

It has been implemented in python requests.get(url, headers, json) I want to do this in Java/Spring.

I tried webclient but it did not work.


Solution

  • To supply a body as part of a GET request using WebClient you would need to use webclient.method(HttpMethod.GET)