gpt4 book ai didi

java - (JAVA)向Binance交易所发送http请求错误

转载 作者:行者123 更新时间:2023-12-02 10:29:23 25 4
gpt4 key购买 nike

我现在正在努力从币安获取加密货币的当前价格。

我引用这个 API-DOCS( https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md ),“交易品种订单簿代码”

但是,我的代码显示了一些错误响应,如下所示

'HTTP/1.1 404 Not Found'

<html><body><h2>404 Not found</h2></body></html>

我的代码如下所示

public static void bid_ask () throws ClientProtocolException, IOException {
String queryArgs = "https://api.binance.com/api/v3/ticker/bookTicker";
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpPost post = new HttpPost(queryArgs);

CloseableHttpResponse response = httpClient.execute(post);
HttpEntity responseEntity = response.getEntity();
System.out.println(response.getStatusLine());
System.out.println(EntityUtils.toString(responseEntity));

}

最佳答案

根据您链接的 API 文档,该 URL 仅支持 GET 请求,但您正在发出 POST 请求。

关于java - (JAVA)向Binance交易所发送http请求错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53696808/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com