#1 2020-12-31 17:13:25

xiwuping
Member
Registered: 2018-02-11
Posts: 32

Can I use mORMot as a Rest Client Library?

I need to access a third-part Rest server (that I have no control) - it will return JSON data.

Is it possible to use mORMot as a Rest Client Library? For example, I'd like to use mORMot to access the JSON data, transform it to Delphi Object, then persist the data to another RDBMS.

Is mORMot a good candidate to accomplish this? Is there any document or sample that I can follow?

Thank you

Last edited by xiwuping (2020-12-31 17:14:18)

Offline

#2 2020-12-31 23:19:12

Vitaly
Member
From: UAE
Registered: 2017-01-31
Posts: 168
Website

Re: Can I use mORMot as a Rest Client Library?

I would recommend taking a look at SynCrtSock unit, there are several client classes. I'm using mostly TWinHTTP-based classes for many third-party REST services with different rather complex schemas. But probably the fastest and easiest way might be TSimpleHttpClient.
JSON parsing to object: https://synopse.info/files/html/api-1.1 … ONTOOBJECT

Offline

#3 2021-01-01 16:27:51

xiwuping
Member
Registered: 2018-02-11
Posts: 32

Re: Can I use mORMot as a Rest Client Library?

Vitaly wrote:

I would recommend taking a look at SynCrtSock unit, there are several client classes. I'm using mostly TWinHTTP-based classes for many third-party REST services with different rather complex schemas. But probably the fastest and easiest way might be TSimpleHttpClient.
JSON parsing to object: https://synopse.info/files/html/api-1.1 … ONTOOBJECT

Thank you @Vitaly.  Appreciate your suggestion.  Following your suggestion, I looked into SynCrtSock.pas, and end up using HttpGet directly, and _JsonFast.

Last edited by xiwuping (2021-01-01 16:29:00)

Offline

Board footer

Powered by FluxBB