Good afternoon.
I'm developing a class in Delphi using the Ticket API. The class is ready and functional, issuing tickets and generating shipping.
This class consists of the Delphi REST components (THTTPBasicAuthenticator, TRESTResponse, TRESTClient, TRESTRequest), which will be generated dynamically at runtime.
The problem refers to the parameter boleto.instrucao
, which in the API can be added repeatedly, thus generating the statement lines.
But checking in my class, it adding only the last one. Debugging the code, I noticed that delphi is omitting repeated parameters.
There is a PHP code from their API documentation that they send this request in array format. But I do not know how to send in array, if the parameter that the TRequest component asks for is string.
Line that adds the parameter:
RSTRequest.AddParameter('....',FPagador.EnderecoComplemento,TRESTRequestParameterKind.pkGETorPOST);
.
.
.
. (mais de 10 parametros)
RSTRequest.AddParameter('boleto.instrucao',FInstrucao1.Text,TRESTRequestParameterKind.pkGETorPOST);
RSTRequest.AddParameter('boleto.instrucao',FInstrucao2.Text,TRESTRequestParameterKind.pkGETorPOST);
RSTRequest.AddParameter('boleto.instrucao',FInstrucao3.Text,TRESTRequestParameterKind.pkGETorPOST);
RSTRequest.Execute;
if RSTResponse.StatusCode <> 201 then
begin
//erro
end
else
begin
//sucesso
end;