🔓Authentication
curl -X GET "https://api.vechainstats.com/v2/network/totals" -H "X-API-Key: YOUR_API_KEY_HERE"import java.net.HttpURLConnection;
import java.net.URL;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class APIClient {
public static void main(String[] args) {
try {
String apiKey = "YOUR_API_KEY";
String apiUrl = "https://api.vechainstats.com/v2/network/totals";
URL url = new URL(apiUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
// Set the request method to GET
connection.setRequestMethod("GET");
// Set the API Key header
connection.setRequestProperty("X-API-Key", apiKey);
// Read the response
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine;
StringBuilder response = new StringBuilder();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
// Close the connection and print the response
in.close();
System.out.println(response.toString());
} catch (Exception e) {
e.printStackTrace();
}
}
}
Example request:
https://api.vechainstats.com/v2/account/vet-vtho
?address=0xd0d9cd5aa98efcaeee2e065ddb8538fa977bc8eb
&VCS_API_KEY=YOUR_API_KEYLast updated