Runescape Bot Stats
RSBotStats is an API that allows scripters to easily track tasks their scripts have accomplished.
Add to your script with a simple JSON POST request. Use to showoff and market your script!
Real stats from a cooking script!
Getting Started with the API
Sign up and add your script here
Find your API Key and Script ID here
Send a POST request to upload your stats. We recommending sending 1 request on script end.
Example Request
URL: http://pure-woodland-47666.herokuapp.com/api/v1/commits?user_email=YOUR_EMAIL&user_token=YOUR_API_KEY
Body:
{"commit":{
"script_id": "X5VTnp",
"user_id": "qN4tOb",
"runtime": 75.666,
"stats_attributes": [
{
"task": "Trout Caught",
"amount": 28
},
{
"task": "Lobster Caught",
"amount": 70
}]
}}
Parameter Notes
At the very least, a commit requires `script_id`, `user_id`, and `runtime`
`runtime` is in minutes
`stats_attributes` are for tracking any sorts of tasks your script does. ex: Fish Caught, Yews Chopped, XP Gained, GP gained, etc.
`user_id: qN4tOb` is the catch-all user. Use this as default.
Example Java JSON POST method
I'm not too familiar with Java.
If someone could share a method to create a JSON post request, "that would be great".
Here's an example from a scripter named Encoded which you can use with some minor tweaks:
public static void commit(long runtime, int experience) {
try {
runtime = (int) (runtime / 1000 / 60000);
String payload =
"{\"commit\":{\"script_id\": \"" + SCRIPT_ID + "\",\"user_id\": \"qN4tOb\",\"runtime\": " + runtime
+ ",\"stats_attributes\": [{\"task\": \"XP Gained\", \"amount\": " + experience + "}]}}";
URL url = new URL(URL + "?user_email=" + EMAIL + "&user_token=" + API_KEY);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json");
conn.connect();
byte[] data = payload.getBytes(StandardCharsets.UTF_8);
DataOutputStream wr = new DataOutputStream(conn.getOutputStream());
wr.write(data);
wr.flush();
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
StringBuilder stb = new StringBuilder();
String line;
while ((line = rd.readLine()) != null) {
stb.append(line).append("\n");
}
wr.close();
rd.close();
if (conn.getResponseCode() == 201) {
Logging.debug("Successfully sent script statistics to RS Script Stats.");
} else {
Logging.debug(stb.toString());
}
conn.disconnect();
} catch (IOException ignored) {
}
}
More To Come!
Eager to continue development of this, open to all suggestions and constructive criticism!
Scripters, please use this, thank you
Are you a script user who wants to showoff their stats for a script?
Bug the script author to implement this API, it's easy!