Using alfresco Rest-API inside my java app but cant find a way to make it

So Im trying to implement a syncronization between my Openbravo and alfresco, I just discovered the rest api for alfresco and with some dificulties I get the result i wanted (that was change some permisions of a folder) but now im facing a new problem, I have no clue how to make that call in java code, im not a good developer and I didnt study web, is there any tutorial or documentation on how to make that? I find alfresco a bit dificult since I cant find many tutorials. Thx for the help


I just figured out how to make it posible in a simple way

public String getToken() throws Exception {

HttpClient clientToken = HttpClients.custom()
String OAuthToken = "";
String urlToken = "";
HttpPost httpPost = new HttpPost(urlToken);

JsonObject jsonCredentials = Json.createObjectBuilder().add("userId", "ad")
    .add("password", "ad").build();

StringEntity entity = new StringEntity(jsonCredentials.toString());
HttpResponse response = clientToken.execute(httpPost);

if (response.getStatusLine().getStatusCode() == 201) {

  BufferedReader br = new BufferedReader(
      new InputStreamReader(response.getEntity().getContent()));
  String output = br.readLine();

  if (!output.isEmpty()) {
    JSONObject objetoJSON = new JSONObject(output);
    OAuthToken = objetoJSON.getJSONObject("entry").getString("id");
  } else {
        .debug("The response is empty [Code " + response.getStatusLine().getStatusCode() + "]");

} else {
  log4j.debug("Error retrieving token: " + response.getStatusLine().getStatusCode() + " => "
      + response.getStatusLine().getReasonPhrase());
OAuthToken = Base64.getEncoder().encodeToString(OAuthToken.getBytes());

return OAuthToken;