0
Good evening Guys, I’m a beginner in Delphi and I’m trying to send a creation request for an Api but I’m having some difficulty with the POST. How do I send this? I’m trying for this API: https://reqres.in Thanks for your help.
procedure TfrmPrincipal.Button7Click(Sender: TObject);
var
res: TJSONValue;
ParamNome: TRequestParam;
ParamProfissao: TRequestParam;
ParamArray: array of TRequestParam;
ParamObj: TRequestParam;
begin
ParamNome := RequestParam('name', 'Morpheus');
ParamProfissao := RequestParam('job', 'Leader');
ParamArray :=[
ParamNome,
ParamProfissao
];
ParamObj := RequestParam('nome', ParamArray);
res := TRestService.Ocorrencia.request(
'https://reqres.in/api',
'users',
TRestService.POST
);
ParamObj := RequestParam('nome', ParamArray);
Memo1.Lines.Text := ParamObj.valor.ToJSON;
end;
Anyone can help??
– Junior Medeiros
What’s happening with that code?
– Tiago Rodrigues
Thanks for the help I wasn’t able to copy, but I was able to pass the Paramobj value inside the Array.
TRestService.POST, [ ParamObj ]
– Junior Medeiros