Totally! Here’s what I have so far:
command = "curl -X PUT https://discourse.domain.tld/groups/" + roleID + "/members.json \\\n" +
" -d \'{\"usernames\" : \"" + user.get("username") + "\"}\'\\\n" +
" -H \"Content-Type: application/json\"\n" +
" -H \"Accept: application/json\"\n" +
" -H \"Api-Key: redacted\"\\\n" +
" -H \"Api-Username: Bot\"";
Process nitroProcess = Runtime.getRuntime().exec(command);
String outputString = new BufferedReader(
new InputStreamReader(nitroProcess.getInputStream(), "UTF-8"))
.lines()
.collect(Collectors.joining("\n"));
System.out.println("Output String: " + outputString);
I’m passing an integer for the roleID and user.get("username") is just a String from a JSON request.
I can post more if it would help, but I am trying to be careful to not leak any sensitive information.