Discord REST

mail@pastecode.io avatar
unknown
plain_text
2 years ago
532 B
5
Indexable
Never
String uri = "https://discord.com/api/users/@me";
HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", botToken); // botToken is a string formatted like: "Bot MTk4NjIyNDgzNDcxOTI1MjQ4.Cl2FMQ.ZnCjm1XVW7vRze4b7Cq4se7kKWs" but that's not my token :)
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity<String> entity = new HttpEntity<String>("parameters", headers);
HttpEntity<String> response = restTemplate.exchange(uri, HttpMethod.GET, entity, String.class);
System.out.println(response.getBody());