Easy To Use REST Client Library For #Delphi Firemonkey On IOS And Android


Developer Fabricio Colombo has a free REST client library published up on Github for Delphi Firemonkey. Firemonkey has it’s own built in REST client library but this library looks interesting. The library has only been tested up to Delphi XE7 so it might need a few tweaks for it to compile in Delphi XE8. It lists support for IOS, OSX, and Windows but probably also works on Android. The HTTP client that the library supports is Indy 10 or WinHTTP/WinInet. Additionally, it provides a IHTTPConnection interface on the back end so you can hook in your own HTTP client (like the platform HTTP client in Delphi XE8). The examples for the library show how the library can make a REST request for either GET, POST, PUT, and DELETE in a single line of code. It looks like it makes it very simple to return the JSON from a REST request into a DataSet or even deserialize it into an object (also in a single line of code). The free library should also work with Appmethod. Here is some sample source code for filling a TClientDataSet with JSON data from a REST request:
vDataSet: TClientDataSet;
vDataSet := TClientDataSet.Create(nil);
TDataSetUtils.CreateField(vDataSet, ftInteger, ‘id’);
TDataSetUtils.CreateField(vDataSet, ftString, ‘name’, 100);
TDataSetUtils.CreateField(vDataSet, ftString, ’email’, 100);
RestClient.Resource(CONTEXT_PATH + ‘persons’)
Head over and download the full source code for the third party REST client source code for Delphi Firemonkey.

Comments are closed.