I am trying to get someones profile’s inventory from CS2 and I keep getting met with a 403 error. Is there anywhere I need to put my API key?
try {
URL url = new URL("https://steamcommunity.com/profiles/"+ steamID+ "/inventory/json/730/2");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
int statusCode = conn.getResponseCode();
if(statusCode != HttpURLConnection.HTTP_OK) {
throw new IOException("Received non-OK response from server");
}
} ...
When I visit that link normally from a browse, there is no issue.
New contributor
Yash Salunke is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.