[fpc-pascal] OData and Office365 REST API support

Michael Van Canneyt michael at freepascal.org
Mon Jul 11 23:12:30 CEST 2016



On Mon, 11 Jul 2016, Dmitry Boyarintsev wrote:

> On Mon, Jul 11, 2016 at 2:32 PM, Michael Van Canneyt <michael at freepascal.org
>> wrote:
>
>> As such, I consider web APIs an essential part of the compiler (or indeed
>> any) toolchain. In fact I think FPC is woefully behind in this department...
>>
>
> Then I have API design question.Is it possible not to bind web-apis to
> fcl-web package?

Yes, absolutely.

>
> If my application is already using some other HTTP library (synapse or
> indy), I'd like to keep using it, even for the new API, rather than having
> code duplicating functionality (which would be fcl-web).

Aha !!

I am VERY glad you asked this question. 
I had the same consideration when creating it :-) :-)

In fact, the web-apis are bound only to fpwebclient and restbase units:

I put restbase.pp in fcl-web only because, well, a REST API _is_ web based.
But I could put it in a separate package just as well :-)

fpwebclient contains only TFPAbstractWebclient. 
This is an abstract class, for which I have 2 ready-made descendents:

- fphttpwebclient (which is in fcl-web and uses fphttpclient)
- synapsewebclient (it uses httpsend. I have the source in private,
   but I can publish it anywhere you want)
Both work equally well, I have used both in production.

The only reason I didn't yet implement a version for lnet or Indy, 
is because I didn't have the time... 
But anyone looking at the code for synapse or fphttpwebclient can 
make a descendant in less than half an hour.

We could put the source code for all non-strict-FPC descendants in the
fpcprojects repository, or I could publish them on my github page.
(Which is very empty at the moment)

Michael.



More information about the fpc-pascal mailing list