Skip to content

Using the REST Debugger will help you prototype your Delphi and C++ REST apps

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:

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++.

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.

{ 5 } Comments

  1. Keith | January 17, 2014 at 12:48 pm | Permalink

    Greetings David,

    Thanks for the info.

    This debugger is only for debuging/exloring REST servers other than DataSnap … is this correct?

  2. Dmitry Streblechenko | January 17, 2014 at 2:31 pm | Permalink

    Hi David!
    Al the new REST functionality sounds great, the only problem is I cannot build any Win 32 project that uses REST libraries. In XE5 SP2, drop TRESTClient component and try tto build for Win32: IPPeerResStrs is missing. There is no pas file. There are dcu files for Win64, and dcu/o files for Android/OSX/iOS, but nothing for Win32.

  3. David Intersimone | January 17, 2014 at 3:52 pm | Permalink

    Keith - Absolutely you can use the REST Debugger to talk to any REST Servers including DataSnap REST Servers. I’ll update the post to add some additional info and screen shots. Here is the scoop as a comment.

    If you build a DataSnap REST Server Application using the Project Wizard - just keep the sample methods checked and use the defaults in the wizard to create a project. Compile and run the DataSnap server. Click the start button on the DataSnap server app window.

    Then in the REST Debugger put in the following info for the Request and parameters:

    [Get method]
    URL: http://localhost:8080/DataSnap/REST/TServerMethods1/EchoString/{value}

    Parameters/Add
    kind: URL-Segment
    name: value
    value: abcd

    Then click the Send Request button in the REST Debugger. You’ll see the output JSON in Response Body tab:

    {
    "result":
    [
    "abcd"
    ]
    }

    Then if you change the URL to use the ReverseString method:

    http://localhost:8080/datasnap/rest/TServerMethods1/ReverseString/{value}

    You get the following JSON Response in the REST Debugger Response Body tab:

    {
    "result":
    [
    "dcba"
    ]
    }

  4. Keith | January 17, 2014 at 5:57 pm | Permalink

    Cool Beans!

    Thanks David

  5. davidi | January 20, 2014 at 6:47 am | Permalink

    Keith - one more comment from Jim in R&D about using the REST Debugger and REST Client Components with a DataSnap server:

    "Just keep the server method parameters simple. String and number parameters are fine. But if the server method has a TJSONValue parameter, for example, then it will be difficult to use the REST components to call the server method."

    If you have more complex DataSnap method parameters, for example, one that uses an object instance, you’ll have to write some code to work with the object.

{ 3 } Trackbacks

  1. [...] learn more about using the REST Debugger on the Embarcadero DocWiki and read my recent blog post, "Using the REST Debugger will help you prototype your Delphi and C++ REST apps" at [...]

  2. [...] found a bunch of cool web services site. As I’ve written in past blog posts, you can use the REST Debugger that is included in Delphi, C++Builder and RAD Studio XE5 to explore these services and then use [...]

  3. [...] David I explains more about the REST Debugger here: Sip from the Firehose : Using the REST Debugger will help you prototype your Delphi and C++ REST app…. [...]

Bad Behavior has blocked 4 access attempts in the last 7 days.

Close