TDownload - REST options?

You said you’re planning to implement TDownload this month so I thought I’d be a good idea to point out that it could also handle REST operations if designed that way.

The advantages of having REST via at least GET and POST would be that the same functionality could provide access to public or custom-developed REST APIs.

Essentially all the POST method does is put the query string in POST variables rather than append them to the URL. As a body can also be sent in a POST request that facility would allow for a form of upload capability.

These options would enable developers to provide an optional server-based component to their projects. At the simplest it’d enable things like leaderboards or model catalogs, a more compex example would be uploading a custom avatar image. The possibilities are only limited by the imagination of the developer.

Personally I write stuff like REST APIs in PHP all the time, hell - I even use it as a quick and dirty prototyping system. The creation of REST endpoints is easy and allows for as simple or complex possibilities as the developer desires.

Good idea. Yes, I’ll add to TDownload handling of HTTP verbs, like POST, PUT and others (FpHttpClient, which is our current underlying library, exposes them https://github.com/graemeg/freepascal/blob/master/packages/fcl-web/src/base/fphttpclient.pp#L202 ).

Just thought of something else

Can we also have the option to set a custom User-Agent, I usually make this a message with some useful info for the service I’m using in case I’m doing anything naughty

e.g.

TDownload.UserAgent := ‘MyWonderfulApp - https://example.com - [email protected]’;

The FpHttpClient has an option to just add any HTTP header to the request, which can be User-Agent or anything else. I think I’ll just expose this in TDownload.

Thanks, added to TODO :slight_smile: And sorry for being late with doing this – I have too many things on my plate these days :slight_smile: It will be done ASAP.