Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

REST and No mapping for the Unicode character exists 1

Status
Not open for further replies.

PeterTooo

Programmer
Jul 20, 2021
1
0
0
FI
I am trying to get PDF from via API but when in command restrequest.Execute happens then program crashes with error:
No mapping for the Unicode character exists in the target multi-byte code page.
Does anybody have any idea what is wrong it?
This works with postman so problem must be in my delphi code.

RESTClientx := TRESTClient.Create(nil);
restclientx.AcceptCharset := 'uft-8, *;q=0.8';
restclientx.ContentType := 'application/x- restclientx.FallbackCharsetEncoding := 'raw';
restclientx.BaseURL := '
RESTResponsex := TRESTResponse.Create(nil);
RESTRequestx:= TRESTRequest.Create(nil);

restrequestx.Client := RESTClientx;

RESTRequestx.Method := rmpost;
RESTRequestx.Params.Clear;
RESTRequestx.ClearBody;

RESTRequestx.Params.AddItem;
RESTRequestx.Params.Items[0].Kind := pkHTTPHEADER;
RESTRequestx.Params.Items[0].name := 'username';
RESTRequestx.Params.Items[0].Value := 'xxxxxxx';
RESTRequestx.Params.Items[0].Options := [poDoNotEncode];

RESTRequestx.Params.AddItem;
RESTRequestx.Params.Items[1].Kind := pkHTTPHEADER;
RESTRequestx.Params.Items[1].name := 'password';
RESTRequestx.Params.Items[1].Value := 'xxxxxxxx';
RESTRequestx.Params.Items[1].Options := [poDoNotEncode];

RESTRequestx.Params.AddItem;
RESTRequestx.Params.Items[2].Kind := pkHTTPHEADER;
RESTRequestx.Params.Items[2].name := 'parcels';
RESTRequestx.Params.Items[2].Value := '01234567890';
RESTRequestx.Params.Items[2].Options := [poDoNotEncode];

RESTRequestx.Params.AddItem;
RESTRequestx.Params.Items[3].Kind := pkHTTPHEADER;
RESTRequestx.Params.Items[3].name := 'printType';
RESTRequestx.Params.Items[3].Value := 'pdf';
RESTRequestx.Params.Items[3].Options := [poDoNotEncode];

restrequestx.Execute; <- this will cause error
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top