rest api request object should accept json string lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- Packs · 2022-09-15 14:48 in lazarus we have created rest api. we would like to take json string as a input for rest api. please help us on this issue. ---------------------------------------------------------------------- KodeZwerg · 2022-09-15 15:49 Just 2 arguments, rest-api and json ?? That is a lot of information you provided. Nobody beside you know what you are using. If you start from scratch, Mormot has everything in one library collection, that you need for that purpose. ---------------------------------------------------------------------- Packs · 2022-09-16 01:36 How to create rest api in Lazarus Pascal. Do we have any library Please share ---------------------------------------------------------------------- zeljko · 2022-09-16 06:42 see components/sqldbrest components in lazarus directory, there are also simple examples for sqldbrestapi. ---------------------------------------------------------------------- avra · 2022-09-16 09:58 Quote from: Prakash on September 16, 2022, 03:36:52 amHow to create rest api in Lazarus Pascal.https://github.com/synopse/mORMot2 (A2 From SOAP to REST, TvPlanIt) https://gitlab.com/freepascal.org/fpc/source/-/tree/main/packages/fcl- web/examples/restbridge https://gitlab.com/freepascal.org/lazarus/lazarus/- /tree/main/components/sqldbrest https://lazplanet.blogspot.com/2019/03/basic-rest-api- implementation.html https://sourceforge.net/projects/rest-dataware-componentes/ https://github.com/blikblum/luipack/tree/master/luirest https://github.com/skoro/http_inspector https://github.com/skoro/rio https://github.com/viniciussanchez/RESTRequest4Delphi https://github.com/exilon/QuickORM https://forum.lazarus.freepascal.org/index.php/topic,32137.0.html https://medium.com/@marcusfernstrm/create-rest-apis-with- freepascal-441e4aa447b7 ---------------------------------------------------------------------- KodeZwerg · 2022-09-16 11:10 https://sourceforge.net/projects/lazarus-rest-json-project/ I have not tested, but there are hundrets of examples based on different technologies to do that job. ---------------------------------------------------------------------- Packs · 2022-09-17 03:46 I need rest api server side framework Which should support SSL,cros,json request,json response We have tried json response which is working. We can't able to send json request to api. We can't able to find SSL,cros orgin ---------------------------------------------------------------------- Packs · 2022-09-17 04:00 program webserver; {$mode objfpc}{$H+} uses   {$ifdef UNIX}   cthreads, cmem,   {$endif}   fphttpapp, httpdefs, httproute; procedure route1(aReq: TRequest; aResp: TResponse); begin How to extract json from aReq ( trequest) object.   aResp.Content:='

Route 1 The Default

'; end; procedure route2(aReq: TRequest; aResp: TResponse); begin   aResp.Content:='

Route 2

'; end; begin   HTTPRouter.RegisterRoute('/', @route1);   HTTPRouter.RegisterRoute('/2', @route2);   Application.Port := 1999;   Application.Threaded := true;   Application.Initialize;   Application.Run; end. ---------------------------------------------------------------------- Packs · 2022-09-18 05:49 how to extract json data from api request ---------------------------------------------------------------------- Renat.Su · 2022-09-18 11:03 example with rest from brookFreePascal https://github.com/risoflora/brookfreepascal/tree/main/demos/db/rest ---------------------------------------------------------------------- BlueIcaro · 2022-09-18 11:14 Hi, may be can a be a starting point https://www.youtube.com/watch?v=9N0cxI1Hp0U Also https://www.youtube.com/watch?v=Gy-OcEPgTHg /BlueIcaro ---------------------------------------------------------------------- lazpas · 2022-09-19 01:37 here https://forum.lazarus.freepascal.org/index.php?topic=45723.0 ---------------------------------------------------------------------- Packs · 2022-09-19 17:34 Dear friends, we have created golang rest api it is working fine . It is having problem of un order json . So we have created lazarus application . it is working as per our requirement . But when we need following thing in this api . 1) post request with json 2 ) post with form data 3) ssl 4) CROS Please help us it is possible or not possible in lazarus . ---------------------------------------------------------------------- Packs · 2022-09-21 18:27 This possible or not possible. ---------------------------------------------------------------------- Thaddy · 2022-09-21 18:54 Of course it is possible. ---------------------------------------------------------------------- Packs · 2022-09-22 02:32 please share the sample code . ---------------------------------------------------------------------- KodeZwerg · 2022-09-22 03:29 Have you even tried one of the samples/full projects??? You just repeat saying "give code please" ---------------------------------------------------------------------- bytebites · 2022-09-22 06:08 Post json-content like {"title":"Aida"} Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {$mode objfpc}{$H+} uses  {$ifdef UNIX}  cthreads, cmem,  {$endif}        fphttpapp, httpdefs, httproute, fpjson, jsonparser; procedure route1(aReq: TRequest; aResp: TResponse);var  s:string;  D,E : TJSONData;begin   writeln(areq.Content);   D:=GetJSON(areq.Content);   E:=d.FindPath('title');   s:=E.AsString;//   aResp.SetStatus(200);   aResp.Content:='

Route 1 respone:'+s+'

';end; procedure route2(aReq: TRequest; aResp: TResponse);begin  aResp.Content:='

Route 2

';end; begin  HTTPRouter.RegisterRoute('/', @route1);  HTTPRouter.RegisterRoute('/2', @route2);  Application.Port := 1999;  Application.Threaded := true;  Application.Initialize;  Application.Run;end. ---------------------------------------------------------------------- Packs · 2022-09-22 07:14 Please share me the sample code . I will be most happy. ---------------------------------------------------------------------- Packs · 2022-09-22 07:32 Thanks . It is working . Please help me how to handle CORS and SSL in pascal. Regards, Prakash ---------------------------------------------------------------------- Packs · 2022-09-22 12:53 Quote from: KodeZwerg on September 22, 2022, 05:29:22 amHave you even tried one of the samples/full projects??? You just repeat saying "give code please" I am fresher in pascal because of that I am asking you the code. I have done lot search on this. I am not getting any path for going ahead. ---------------------------------------------------------------------- Packs · 2022-09-22 17:36 Thanks to everyone . I have used following code . It is working for SSL .   Application.Port := 7005;   Application.CertificateData.PrivateKey.FileName:='xyz.key';   Application.CertificateData.Certificate.FileName:='xyz.crt';   Application.UseSSL:= true ; ---------------------------------------------------------------------- Packs · 2022-09-23 05:09 Does anyone is having full documents. We would like to implement form,file upload request in pascal ---------------------------------------------------------------------- Packs · 2022-11-08 03:48 {$mode objfpc}{$H+} uses   {$ifdef UNIX}   cthreads, cmem,   {$endif}        fphttpapp, httpdefs, httproute, fpjson, jsonparser; procedure route1(aReq: TRequest; aResp: TResponse); var   s:string;   D,E : TJSONData; begin    writeln(areq.Content);    D:=GetJSON(areq.Content);    E:=d.FindPath('title');    s:=E.AsString; //   aResp.SetStatus(200);    aResp.Content:='

Route 1 respone:'+s+'

'; end; procedure route2(aReq: TRequest; aResp: TResponse); begin   aResp.Content:='

Route 2

'; end; begin   HTTPRouter.RegisterRoute('/', @route1);   HTTPRouter.RegisterRoute('/2', @route2);   Application.Port := 1999;   Application.Threaded := true;   Application.Initialize;   Application.Run; end.              when I run this code it is working in postman not working in browser . I am getting cors isssue . browse send the preflight request with "options" request . D:=GetJSON(areq.Content); the content is nil. ---------------------------------------------------------------------- Packs · 2023-08-31 17:20 Thanks Everyone . I have created rest api with ssl . it is working . Now I would like to implement jwt token ( creation , validation ). How to implement jwt in lazarus pascal.