As part of the new addition of the REST Client Library components in Delphi, C++Builder and RAD Studio XE5, we also include a REST Debugger so that you can explore REST Services and use it to help prototype the property settings for your app’s REST Client components. We also provide the source code to the REST Debugger and you can build other platform versions (Win64 and OSX) of the debugger. You can also customize and extend the REST Debugger to add capabilities you need in your own development projects. You can also install a link to the REST Debugger on your IDE’s Tools menu to make it easier to launch when you are working on REST based applications. The Embarcadero Docwiki has articles that will help you understand and use the REST Debugger. I won’t repeat the documentation here and instead point you to the following documents:
- Rest Debugger - http://docwiki.embarcadero.com/RADStudio/XE5/en/REST_Debugger
- Using the REST Debugger - http://docwiki.embarcadero.com/RADStudio/XE5/en/Using_the_REST_Debugger
- Installing the REST Debugger in your IDE’s Tools menu - http://docwiki.embarcadero.com/RADStudio/XE5/en/Installing_the_REST_Debugger
Building an OSX Version of the REST Debugger
The source code for the REST Debugger is included in the Delphi, C++Builder and RAD Studio XE5 installation in the "C:\Program Files (x86)\Embarcadero\RAD Studio\12.0\source\data\rest\restdebugger" folder. The REST Debugger is built using Delphi, FM and the REST Client Library components. You can build a Win64 and OSX version of the REST Debugger. Here are the steps:
- Copy the REST Debugger source folder to another folder on your computer, especially if you are going to modify the source code. I copied it to my Documents\RAD Studio\Projects folder
- Start the XE5 IDE
- Open the REST Debugger project - "File | Open Project …" - navigate to where you copied the REST Debugger source folder and select the RESTDebugger.dproj file
- Select the Project | Options menu item to bring up the REST Debugger project options.
- Set the Target Options to "All configuration - All platforms" using the ComboBox
- Set the "Project | Options | Delphi Compiler | Output directory" (note: it currently contains "$(BDS)\bin") to .\$(Platform)\$(Config)
- Set the "Project | Options | Delphi Compiler | Unit output directory" (note: if currently contains "$(BDSLIB)\$(PLATFORM)\$(CONFIG)") to .\$(Platform)\$(Config)
Here are screen grabs of the REST Debugger Project Options before and after these steps:
- In the Project Manager window, Activate the Target Platform to OSX (or add the 64-bit Windows platform target and Activate it if you want to build a 64-bit Windows REST Debugger). Set the Build Configuration to Release. Set the OSX Target Platform configuration to Normal.
- Since the REST Debugger uses the ClientDataSet in the "Tabular Data" for the REST Request Results, we need to include MIDAS in our Project | Deployment files list. Using Project | Deployment, click on the "Add Feature Files" button in the toolbar and check the MIDAS Library checkbox. Then click the OK button.
- Use File | Save ALL to save all your changes.
- Compile or Build the project to make sure it compiles okay. You’ll now have a sub-folder containing the RESTDebugger OSX application.
- With your IDE connected to a Mac and with the PAServer running, click the Run without Debugging button.
- On the Mac set the Request URL to http://api.discogs.com/. Set the Content Type to application/json. Click the "Send Request" button and see the REST Request results.
Here is a screen grab of the REST Debugger running on my MacBook Pro with OSX Mavericks.
Explore, Prototype and Build your REST based Apps
You can use the REST Debugger to explore the REST services you want to integrate into your Delphi and C++Builder apps. Recent blog posts by John Thomas (JT), Sarina Dupont and David I have tutorial examples for building VCL and FM desktop and mobile apps using Delphi and C++.
- No time to rest: Endless possibilities with REST for VCL and FM - http://blogs.embarcadero.com/jtembarcadero/2013/12/19/no-time-endlesss-possibilities-with-rest-for-vcl-and-fm/
- Riding the waves over the holidays with REST - http://blogs.embarcadero.com/sarinadupont/2013/12/24/589/
- Riding the waves with REST and C++Builder for iOS - http://blogs.embarcadero.com/davidi/2014/01/07/43191
Have fun exploring the world of REST Services and the new REST Client Library and Components included in Delphi, C++Builder and RAD Studio XE5.