私は春にはとても新しいです。休憩サービスから何かを得るのに問題があります。私が間違っていることに対する答えを得たいです。事前に感謝!Springで休憩サービスからの回答を得ることができない
これは私が答えを得ようとしている場所からの残りのサービスです: ここに私のコードです。
package testi;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;
import java.util.Arrays;
@SpringBootApplication
public class TestiApplication {
public static void main(String[] args) {
SpringApplication.run(TestiApplication.class, args);
}
public void run(String... args) throws Exception {
RestTemplate restTemplate = new RestTemplate();
//Asetettaan otsikkotietueet
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Arrays.asList(MediaType.APPLICATION_JSON));
headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("X-ESA-API-KEY", "ROBOT");
HttpEntity<String> entity = new HttpEntity<String>("parameters", headers);
System.out.println("Testing " + entity.getHeaders());
String answer = restTemplate.postForObject("https://www.veikkaus.fi/api/v1/sport-games/draws?game-names=MULTISCORE", entity, String.class);
System.out.println(answer);
//ResponseEntity<String> response = restTemplate.exchange("https://www.veikkaus.fi/api/v1/sport-games/draws?game-names=MULTISCORE", HttpMethod.GET, entity, String.class);
//System.out.println(response);
}
}
申し訳ありません、残りのサービスをここに追加するのを忘れてしまいました。 https://github.com/VeikkausOy/sport-games-robot/blob/master/README.md – Miira
?あなたは例外を取得していますか?そうであれば、あなたの投稿にそれを含めてください。 – Kayaman
あなたはどんな問題を抱えていますか? – reos