The REST Debugger is a powerful tool for testing and managing different REST APIs. With its user interface, you can test and debug REST queries before applying them to your own REST applications. After setting up your REST queries, you can then copy and paste the components onto your form to further speed up application development. This works for both your VCL and FireMonkey applications.
I recently built a medical terms (SNOMED CT) healthcare multi-device FireMonkey application. Today, I thought I would show you how to use the REST Debugger to create the VCL version. Many healthcare applications use SNOMED CT to provide healthcare personnel access to the latest medical definitions.
You can access the REST Debugger via the Tools menu in RAD Studio XE7.
For this demo, I signed up for an account at http://bioportal.bioontology.org/accounts/new to receive the API key needed to build my application.
On the Request tab, I set the URL to http://data.bioontology.org/. Next, I defined some parameters for my query. I set the Resource to search and defined two GET/POST Request Parameters. One for the apikey and one for the query (q). By clicking on Send Request and selecting the Tabular Data tab, you can see the data that has been returned for your query. In this case, the predefined value for q that I set in the REST Debugger was biceps.
Once you have tested your query, you can click on Copy Components. This will generate the components with all the correct properties already set. Then create a new VCL application in RAD Studio XE7 and paste the components onto your form. The last step will be to hook up your user interface.
In addition to the components that were generated via the REST Debugger, this demo consists of several TEdit and TButton controls and a TMemo. It also uses a TActionList component to connect the Prior and Next button to the built-in LiveBindings actions.
All the user interface elements are connected to our data via the LiveBindings Designer.
This application only consists of a single line of code to execute the REST Request when the user clicks on the Search button.
procedure TVCLRESTDemo.SearchButtonClick(Sender: TObject); begin RESTRequest1.Execute; end;
Brian Alexakis covered the REST Debugger in depth with his last VCL Skill Sprint session. Access the source files for his VCL Twitter REST demo, video and resource links here.
Get Free Bonuses with the purchase of RAD Studio XE7, Delphi XE7 & C++Builder XE7 until Dec. 31, 2014.
This offer includes:
Object Pascal Handbook by Marco Cantu
Castalia for Delphi - now with new feature: Show Debug Variables
VCL and FireMonkey Premium Styles
and more
Get all the details at http://www.embarcadero.com/radoffer