milan 0 Posted August 27, 2020 The OverbyteIcsHttpRestTst.dproj sample has a grid titled REST Parameters where i enter Name - "verify" and Value - "true". I need JSON {"verify":true} but method RestParams.GetParameters return {"verify":"true"}. Parameter aRaw make nothing. Share this post Link to post
Angus Robertson 577 Posted August 27, 2020 Sorry, currently TRestParams does not create boolean or numeric parameters, you'll need to construct the Json manually or with SuperObject. Angus Share this post Link to post
milan 0 Posted August 28, 2020 Thank you and at the same time please: I construct the Json manually, but where to assign in? Milan Share this post Link to post
Angus Robertson 577 Posted August 28, 2020 The RestRequest method includes RawParams string which is where pverides any TRestParams. Angus Share this post Link to post
milan 0 Posted August 28, 2020 (edited) But if it does not take place function GetParams, will stay after THttpCli.Create FContentPost := 'application/x-www-form-urlencoded'; because it will not be replaced: OverbyteIcsSslHttpRest.pas: ... line 1818 { V8.64 set Json content type if empty } if (Params <> '') and (FContentPost = '') then begin if (Params[1] = '{') or (Params[1] = '[') then FContentPost := 'application/json; charset=UTF-8'; { V8.61 added UTF8 } excuse my English Milan Edited August 28, 2020 by milan Share this post Link to post
Angus Robertson 577 Posted August 28, 2020 If you use RawParams you also need to set ContentPost to say what you are posting. BTW, all the REST APIs I've used so far have accepted a Json value of 'True', but I will look at improving TRestParams, not immediately though. Angus Share this post Link to post
milan 0 Posted August 28, 2020 Thank you very much. In the meantime I will set HttpRest.ContentTypePost : = ''; (instead 'application/x-www-form-urlencoded' set from Create) and code in OverbyteIcsSslHttpRest.pas: line 1818 { V8.64 set Json content type if empty } if (Params <> '') and (FContentPost = '') then begin if (Params[1] = '{') or (Params[1] = '[') then FContentPost := 'application/json; charset=UTF-8'; { V8.61 added UTF8 } will come into effect. Milan Share this post Link to post