简体   繁体   English

在 java 的 get 请求中发送 Json

[英]Sending a Json in get request in java

There is an API which sends back data on get request from a database.有一个 API 在从数据库获取请求时发回数据。 The database is huge, so the data we need, we have to specify it in json.数据库很大,所以我们需要的数据,我们必须在json中指定。 So actually we have to send a json with get request to get back the desired data.所以实际上我们必须发送一个带有 get 请求的 json 来取回所需的数据。

It has been implemented in python requests.get(url, headers, json) I want to do this in Java/Spring.它已在 python requests.get(url, headers, json)中实现,我想在 Java/Spring 中执行此操作。

I tried webclient but it did not work.我尝试了 webclient 但它没有用。

To supply a body as part of a GET request using WebClient you would need to use webclient.method( HttpMethod.GET )要使用WebClient将正文作为 GET 请求的一部分提供,您需要使用 webclient.method( HttpMethod.GET )

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM