Equivalent components from VCL ones.

In VCL example I have the next code:

procedure TAuthentication.BtnLoginUser2Click(Sender: TObject);
var Client :IMVCRESTClient;
    Rest   :IMVCRESTResponse;
    JSON   :TJSONObject;
   Client := TMVCRESTClient.New.BaseURL(HOST, 8080);

   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);

   JSON := TSystemJSON.StringAsJSONObject(Rest.Content);
      JWToken := JSON.GetValue('token').Value;
      Self.Caption := 'Authentication (User 2) Manager';

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!


This is not help!

That is a reference documentation whose purpose is not to teach but to enumerate properties, methods, and event handlers.

The code on this page doesn't explain anything but the associated property, event, or method. Not a global understanding of the components.

Have you seen on this suggested page how to send authentication information? Something about the headers, etc.

Thank you very much for your time, but I checked this page many times. It is an obvious place to find first aid, but my question asks for a deep acknowledgment.

I found it in section 3.14 of Holger Flick's book.


This page mentions in the 2nd paragraph how to set headers

Optionally, HTTP request headers can be set. The HTTP request headers are set via WebHttpRequest.Headers. This is a value/pair list of HTTP options. Default, the option CacheControl is set to no-cache