Hello!
I'm trying to send a POST request to a server, that expects username and password as parameters.
I tried in Postman and works perfectly, but I don't know how to do it in Delphi.
I tried to add the params to the request header,
Req.Headers.SetValue('userName', 'user');
Req.Headers.SetValue('password', 'pass');
Response := Client.Send(Req);
or in the body:
Params := TStringList.Create;
Params.Add('userName='+User); // tried also ":" instread of "=".
Params.Add('password='+Pass);
Req.SetContent(TEncoding.UTF8.GetBytes(Params.Text));
but in both cases I get the error:
{
"message": "Incorrect value of parameter \"userName\"!",
"exceptionClass": "si.zzi.rose.edi.RoseEdiException",
"stack": [],
"suppressed": []
}
Since executing on Postman works flawlessly, I presume is a problem of where put the params for the request.
I would kindly ash for support.
Regards,
m@rko