JT wrote a great tutorial on the endless possibilities with REST for VCL and FM.
I wanted to do a follow-on tutorial that used TFDMemTable instead of TClientDataSet. The steps are very similar.
Please note that the steps below assume that you went through JT’s tutorial already.
Place FDMemTable onto your form. Select RESTResponseDataSetAdapter1 and set the Dataset property to FDMemTable1. Right-click on RESTRequest1, select ‘Execute’ and then set the ‘Active’ property for both components to true.
To add fields for data binding, right-click onto the FDMemtable component and select ‘Fields Editor’. Right-click inside the Fields Editor window and select ‘Add Fields’ and click OK. In my example, I decided that I wanted to get all the surf spots so I set the Resource field for RESTRequest1 to ‘api/spot/all’.
I also wanted to display the county name for a selected surf spot. I right-clicked on the ‘county_name’ member in my FDMemTable in the LiveBindings Designer and selected to ‘Link to New Control’ and selected a TLabeledEdit.
The last step was to bind the ListBox1 Sync property to * in my FDMemTable. This ensures that my records are kept in sync. This is visible when clicking on an item in my list as you will see the county name update in the labeled edit below.
Check out the great year end special offers and start leveraging REST services in your VCL and FM apps.