In VCL example I have the next code:
procedure TAuthentication.BtnLoginUser2Click(Sender: TObject);
var Client :IMVCRESTClient;
Rest :IMVCRESTResponse;
JSON :TJSONObject;
begin
Client := TMVCRESTClient.New.BaseURL(HOST, 8080);
Client.ReadTimeOut(0);
Rest := Client.Post('/login', Format('{"jwtusername":"%s","jwtpassword":"%s"}', [USERNAME_2, PASSWORD_2]));
if not Rest.Success then begin
ShowMessage('HTTP ERROR: ' + Rest.StatusCode.ToString + sLineBreak +
'HTTP ERROR MESSAGE: ' + Rest.StatusText + sLineBreak +
'ERROR MESSAGE: ' + Rest.Content);
Exit;
end;
JSON := TSystemJSON.StringAsJSONObject(Rest.Content);
try
JWToken := JSON.GetValue('token').Value;
Self.Caption := 'Authentication (User 2) Manager';
finally
JSON.Free;
end;
end;
I want to use it on TMS Web Core.
I think the IMVCRESTClient component is unnecessary because its functionality is inside the TWebHttpResponse component. Is this correct?
How to do the Rest := Client.Post('/login', Format('{"jwtusername":"%s","jwtpassword":"%s"}',
????
Please, I need some help.
Thank you!