Through JAVA, I need to make a request via POST, where I get a JSON with a token. The JSON return I get after sending the POST is this:
{
"Token": "e27bb0a7-e65b-4cc3-a82e-7a2a3c26a248",
"Codigo": 0
}
How do I make this process in java without using controller and ajax?
In Javascript it was done this way:
$(document).ready(function() {
var settings = {
"async": true,
"crossDomain": true,
"url": "https://siteexemplo.br/login/geraTok",
"method": "POST",
"headers": {
"content-type": "application/json",
},
"data": {
"RA": "12345",
"senha": "xxx"
}
}
$.ajax(settings).done(function (response) {
var token = response.Token;
});
});