Converting a DA Binary Client/Server to Rest/JSON

Hi,
I have used the wizard to generate a Simple Delphi Custor DA Server an its client.
Now I would like to modify it to support REST/JSON so our customers can connect to the server in a Rest way (GET, PUT, etc…) with any other language (PHP, Python, Perl, Java etc).
What are the recommanded steps to do this ?
Is there a way to get the server working a Bin and Res/JSON a the same time ?

Is there a way to Generate a OpenAPI 2.0 api spec file, and a Swagger UI documentation interface like in this project ?

Best regards

Armindo

Hi,

Is there a way to get the server working a Bin and Res/JSON a the same time ?

You can add TROJSONMesssage into server dispatchers.

Is there a way to Generate a OpenAPI 2.0 api spec file, and a Swagger UI documentation interface like in this project ?

for supporting OpenAPI use TROHttpApiDispatcher.

you can find the Adding HttpAPI to a Server (Delphi) article useful.


if above isn’t suitable, you can implement HTTPServer.OnCustomResponseEvent event, as described in Using OnCustomResponseEvent in a ROSDK Server snippet. here you can parse client’s requests and change them.

Thanks Evgeny for your reply.
in your article it seems that you have to add manually every method.
But how to do this automatically in particulary in DA where you may have a GET/POST/DELETE per table ?
Best regards

for DA, you can use TDAODataSchemaDispatcher.
it works similar to any other TROExtendedHttpDispatcher descendant and accepts data in .xml or .json format

Thanks Evgeny I will try tonight