REST Web Services

I am trying to learn to write a Delphi REST Web Service program (both the server and the client side). Currently my platform is Delphi 11 Community Edition supporting Internet Direct (Indy) 10.6.20. I searched through the Internet have not found sample codes or explanations. All I found is some videos using DataSnap project but In delphi 11 I could not Find File->New->Other->Data Snap. The only option is “Soap Server Application”.

If my current version of Delphi does not support REST, Could you then provide SOAP based (server and client) source code and explanation.

Since I am newbie, could anyone share source code and explanations. Thanks in advance

1 Like

If you are going to write good applications, its best to stay clear of the inbuilt stuff and learn a good framework from the start. You might want to start with something simple like ‘horse’ (google delphi horse) or learn how to place a TIndyHTTPServer onto a data module and code out requests/responses to get a feel for how the basics work. After that you’ll probably want to investigate mORMot or DMVCFramework

For client rest, you probably want to base your calls around the TNetHTTPClient component.
I prefer code for REST calls rather than dropping components onto forms, so a wrapper around TNetHTTPClient is ideal.

I haven’t got code available to share publically, but ideally you want to build a class that allows
if TMyWebRequest.get('',outcome) = 200
where outcome = TStream.

1 Like

Thank you for reply.