Answer the question
In order to leave comments, you need to log in
Why does DonationAlerts return 'Unauthenticated.' JAVA?
Tried to connect to the DonationAlerts API but it outputs 'Unauthenticated.'
public static void main(String[] args) throws Exception {
String API = "API_TOKEN";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://www.donationalerts.com/api/v1/alerts/donations"))
.header("Authorization", "Bearer " + API)
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question