- 邏輯
String url = prometheusServer + api;
MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
// 查詢參數
map.add("query", sql.toString());
HttpHeaders headers = new HttpHeaders();
headers.add("Content-Type", "application/x-www-form-urlencoded");
HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(map, headers);
// 接受響應的類要與 接口響應一致,不然報錯
ResponseEntity<PostResultVo> exchange = restTemplate.postForEntity(url, request, PostResultVo.class);
if (null != exchange && null != exchange.getBody() && null != exchange.getBody().getData()) {
}