Using The REST Client Library To Access REST-based Web Services
Using The REST Client Library To Access REST-based Web Services
This REST BaaS (Backend as a Service) client tutorial shows how to use the REST Client_Library for accessing
REST-based web services (REST stands for Representational State Transfer). The REST library is available for all
platforms that are supported by Delphi. The REST Library framework focuses on JSON as the representation format.
XML is not explicitly supported.
Tip: This example requires an SSL encrypted connection. You can install the SSL library and copy
thelibeay32.dll and ssleay32.dll files to your system path.
For Delphi, choose File > New > FireMonkey Desktop Application - Delphi.
For C++, choose File > New > FireMonkey Desktop Application - C++Builder.
Note: The REST components are automatically connected together. Otherwise, you should set
the Client and Response properties of the TRESTRequest component
toRESTClient1 and RESTResponse1, respectively.
2. In the Object Inspector, set the BaseURL property of the TRESTClient to http://api.discogs.com/.
3. Select the TRESTRequest component on the form and set the following properties:
Note: The Resource URI (artist/{NAME}) has an internal parameter, enclosed in curly braces. The internal
parameter value automatically adds an URL segment parameter to TRESTRequest component.
Open the LiveBindings Designer. The diagram with no connections is similar to the following image:
5. In the Object Inspector, set the following properties of the TMemo component:
If you have called the Execute method of the TRESTRequest component, the TMemo should already display
the RAW JSON results.
10. From the list that appears, select the TEdit control.
Note: The Add control label check box is checked by default, so a TLabel is created for the TEdit control.
1. Add a TComboBox component on the panel and set the following properties:
In the Object Inspector, open the String List Editor for the Items property.
Delphi:
The TJSONValue and TJSONObject classes are declared in the Data.DBXJSON unit, so you need to
add Data.DBXJSON in the uses clause of your unit.
C++:
The TJSONValue and TJSONObject classes are declared in the Data.DBXJSON library, so you need to
add #include <Data.DBXJSON.hpp> in your header unit.
See Also
REST Debugger
RESTDemo Sample
LiveBindings Designer