我现在正在研究从币安获取当前加密货币的价格。
我引用此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));
}
答案 0 :(得分:1)
根据您链接的API文档,该URL仅支持GET请求,但您正在发出POST请求。