I have the following CURL request Can anyone please confirm me what would be the subesquest HTTP Request
curl -H "Authorization: Bearer <access token>" --data-urlencode "model=" --data-urlencode "imageurl.img.com" apiurl.api.com
What I tried:
HttpURLConnection conn = (HttpURLConnection) obj.openConnection();
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setRequestMethod("POST");
conn.setRequestProperty("Accept", "application/json");
conn.setRequestProperty("Authorization", "Bearer " + token);
conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
String payload = "model=\"\"&url=" + url;
OutputStreamWriter writer = new OutputStreamWriter(conn.getOutputStream(), "UTF-8");
writer.write(payload);
writer.close();
The problem is I keep getting a 403 HTTP Error code. It works with CURL, so I might not be converting it right.
What can I do to make the conversion?
@EDIT
API: http://wiki.vg/Mojang_API#Change_Skin Mojang's Example:
curl -H "Authorization: Bearer <access token>" --data-urlencode "model=" --data-urlencode "url=http://assets.mojang.com/SkinTemplates/steve.png" https://api.mojang.com/user/profile/<uuid>/skin