Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!

Learn How To Add Endpoints To RAD Server In The Hospitality Survey App Template

The Hospitality Survey EMS project is part of the Hospitality Survey App template for Delphi 10.2 Tokyo that Embarcadero has released through their GetIt platform. The Hospitality Survey App consists of four different projects. In this blog post I am going to cover the Hospitality Survey EMS project. It is the backend RAD Server module for the Hospitality Survey Client and the Hospitality Survey Admin to interface with via REST.

RAD Server is a turn-key application foundation for rapidly building and deploying services based applications on Windows and Linux. RAD Server provides automated Delphi and C++ REST/JSON API publishing and management, Enterprise database integration middleware, IoT Edgeware and an array of application services such as User Directory and Authentication services, Push Notifications, Indoor/Outdoor Geolocation and JSON data storage.

The Hospitality Survey EMS end points mainly return the FireDAC JSON format which can be easily loaded in to a RAD Studio client or accessed via standard JSON in a non-RAD Studio environment like AngularJS or Sencha. Here is some sample Javascript code in AngularJS for accessing FireDAC JSON:



GET /survey/ – Download the survey questions in FireDAC JSON format.
GET /survey/results/* – Download the survey results in a paged fashion in FireDAC JSON format. The page number is placed where the * is.
GET /survey/stats/all – Download various stats about the survey results in FireDAC JSON format.
GET /survey/details/* – Download the questions and answers from a specific survey ID in FireDAC JSON format. The survey ID is placed where the * is.
GET /survey/emails/csv – Download a list of all of the email addresses from completed surveys in CSV format.
GET /tenants/ – Download a list of the server Tenants which are active in FireDAC JSON format.

You can easily extend the server with your own end points and custom functionality. Below I will give an overview of how you can do that.

You can also find out more information about how the Resource Suffixes work in the Embarcadero DocWiki. The endpoints are defined like this in code:

As you can see in the code the ResourceName is the name of the overall endpoint and actually returns the list of questions for the Survey App via a GET call. The GetData function handles the Results, Stats, Details, and Emails requests. While the PostData function handles the submission of completed surveys to the server. You can easily tie into the GetData function by just adding more query parameters.

The variable in the /survey/results/* and /survey/details/* endpoints is accessed via ARequest.Segments object like below:

If you would like to edit the questions of your survey in the server database after it has been created you can use the Hospitality Survey Editor.

Be sure to check out the full Hospitality Survey App Template source code and try it out for yourself!


Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

About author

FMXExpress.com has over 600 articles with all kinds of tips and tricks for Delphi FireMonkey on Android, IOS, OSX, Windows, and Linux.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.