Recent

Author Topic: rest api request object should accept json string  (Read 3620 times)

Prakash

  • Full Member
  • ***
  • Posts: 169
rest api request object should accept json string
« on: September 15, 2022, 04:48:53 pm »
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

  • Hero Member
  • *****
  • Posts: 2066
  • Fifty shades of code.
    • Delphi & FreePascal
Re: rest api request object should accept json string
« Reply #1 on: September 15, 2022, 05:49:13 pm »
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.
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

Prakash

  • Full Member
  • ***
  • Posts: 169
Re: rest api request object should accept json string
« Reply #2 on: September 16, 2022, 03:36:52 am »
How to create rest api in Lazarus Pascal.
Do we have any library
Please share

zeljko

  • Hero Member
  • *****
  • Posts: 1596
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: rest api request object should accept json string
« Reply #3 on: September 16, 2022, 08:42:12 am »
see components/sqldbrest components in lazarus directory, there are also simple examples for sqldbrestapi.


KodeZwerg

  • Hero Member
  • *****
  • Posts: 2066
  • Fifty shades of code.
    • Delphi & FreePascal
Re: rest api request object should accept json string
« Reply #5 on: September 16, 2022, 01:10:10 pm »
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.
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

Prakash

  • Full Member
  • ***
  • Posts: 169
Re: rest api request object should accept json string
« Reply #6 on: September 17, 2022, 05:46:13 am »
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



Prakash

  • Full Member
  • ***
  • Posts: 169
Re: rest api request object should accept json string
« Reply #7 on: September 17, 2022, 06:00:55 am »
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:='<html><body><h1>Route 1 The Default</h1></body></html>';
end;
 
procedure route2(aReq: TRequest; aResp: TResponse);
begin
  aResp.Content:='<html><body><h1>Route 2</h1></body></html>';
end;
 
begin
  HTTPRouter.RegisterRoute('/', @route1);
  HTTPRouter.RegisterRoute('/2', @route2);
  Application.Port := 1999;
  Application.Threaded := true;
  Application.Initialize;
  Application.Run;
end.

Prakash

  • Full Member
  • ***
  • Posts: 169
Re: rest api request object should accept json string
« Reply #8 on: September 18, 2022, 07:49:30 am »
how to extract json data from api request

Renat.Su

  • Full Member
  • ***
  • Posts: 232
    • Renat.Su
Re: rest api request object should accept json string
« Reply #9 on: September 18, 2022, 01:03:31 pm »

BlueIcaro

  • Hero Member
  • *****
  • Posts: 792
    • Blog personal
Re: rest api request object should accept json string
« Reply #10 on: September 18, 2022, 01:14:47 pm »
« Last Edit: September 18, 2022, 01:16:30 pm by BlueIcaro »

lazpas

  • Jr. Member
  • **
  • Posts: 83

Prakash

  • Full Member
  • ***
  • Posts: 169
Re: rest api request object should accept json string
« Reply #12 on: September 19, 2022, 07:34:44 pm »
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 .

Prakash

  • Full Member
  • ***
  • Posts: 169
Re: rest api request object should accept json string
« Reply #13 on: September 21, 2022, 08:27:28 pm »
This possible or not possible.

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: rest api request object should accept json string
« Reply #14 on: September 21, 2022, 08:54:31 pm »
Of course it is possible.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

 

TinyPortal © 2005-2018