Has anyone done one? I’d appreciate some help with the basics (I have a Delphi desktop app that I’d like to connect to a remote server. The server is set up - I need code in the desktop app to register users and make calls to the API).
As you can imagine, code gets quite bloated and ugly with all this TJSONObject wrapping, so I might be doing a Delphi swagger-codegen template in some weeks so you can generate SDK from your service definitions. Which is working great for Android/iOS but in their ~30 supported languages, they do lack Delphi…(not surprising me…really dont like it )
@paulsmith would you be up for doing this in a joined effort ?
@philicious. Thanks for the link. I’m a novice at this, and I have to confess I have no idea what a swagger-code template is - although I am intrigued. Anyway, here for the cause is what I have - code to log on, and then to put the JSON response into a data table. Still have to figure out user account creation. Comments and corrections welcome. Best regards, Paul
You might think that one thing a component called TRESTResponseDatasetAdapter would do is ingest a JSON response and extrude a dataset. I spent an evening trying to make it do that, and ended up just writing the code. See the sample in my earlier post. If you know how to do it with the component, please let me know.
@paulsmith I have to admit I’m not that deep into the Delphi code here. My responsibility ends where data is received. but I’ve seen the Devs use TRESTResponseDatasetAdapter and feed it with the JSON response.
Unfortunately I cant share enough of our code that would help you but I did a quick google and maybe these examples will help you get it running:
On the other hand, you dont have to use TRESTResponseDatasetAdapter at all. You could also read and use the JSON response yourself.
(Personally, I’m not a big fan of all those “magic” Delphi components anyways. I’ve seen them failing or behaving in a weird unpredictable way often enough. And they are terrible to debug )