0
Good afternoon.
I am developing a class in Delphi, using the Boleto Cloud API. The class is now ready and functional, issuing billets and generating shipment.
This class consists of the REST Delphi 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 instruction lines.
But checking in my class, she adding only the last placed. Debugging the code, I realized that Delphi is omitting repeated parameters.
There is a PHP code of their API documentation, which they send this request in array format. However, I don’t 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;
Thanks again Daniel for the help. Unfortunately it didn’t work. When sending, the boleto received the instruction without breaking the line and with errors in accented characters. In PHP works well. Still, thank you!
– André
@André Try to put it like this:
RESTRequest.AddParameter('boleto.instrucao',JSArray.ToString,TRESTRequestParameterKind.pkGETorPOST, [poDoNotEncode]);
– Daniel Grillo