What is the REST Debugger?
In RAD Studio there is a superbly useful tool called the REST Debugger. It comes included with RAD Studio C++ Builder. It is very useful to test REST Requests such as “Gets” and “Posts” to see what effect they have and view their results. It is very easy to automatically set up the REST components with their parameters which can then be pasted or copied into your source code – potentially saving you hours of coding. We can easily set up the components by using REST Debugger Tool in RAD Studio – either C++ Builder or Delphi – it works with both.
How do I launch the REST Debugger in RAD Studio?
You can launch the REST Debugger from the Tools menu of RAD Studio. The Embarcadero REST Debugger empowers developers to explore, test, and ultimately understand how a RESTful web service works. You can dive right into REST data with filterable JSON blobs, streamlined OAuth 1.0/2.0 authentication, and configurable request/resource parameters. You can directly copy and paste REST components from the REST Debugger to the RAD Studio, Delphi, or C++Builder IDE. This enables the configuration and consumption of REST services in Delphi or C++Builder apps with just a few clicks.
The REST Debugger allows you to test your connections REALLY easily and you can easily see how to reach or transfer your data. There is also a free version that can be used by other REST tools and it can be downloaded from RESTDebugger.
Is there an example of how to connect to a REST service?
Do you want to add live exchange rates features to your applications? In this example, we will a use a free API that allows us to get the latest currency exchange rates. ExchangeRates API is delivers exchange rates data live for more than 170 world currencies with over 15 exchange rate data sources. It has several endpointseach of which serves a different purpose or use case.
How do I use the ExchangeRates API?
Using the ExchangeRates API is very simple, here are the steps,
- Sign Up to ExchangeRates API can be registered from exchangeratesapi.io
- Get your API Access Key from the https://manage.exchangeratesapi.io/dashboard and simply attach your unique Access Key to one of the endpoints as a query parameter like so:
- If you registered to ExchangeRates API, your link example can be found in 3-Step QuickStart Guide.
- There are 5 main API Endpoints: latest, historical, convert, time series and fluctuation. Through these endpoints you can access different kinds of data, all starting with the Base URL.
- Integrate into your application
- Now you can test your connection with REST Debugger or with your REST Client applications.
How do use the REST Debugger to automatically set up and connect components?
To get exchange rate with REST Debugger, copy your URL with your API Key
For example, we can easily read all exchange rates in Euro € by using this API link and Rest Debugger. Go to Tabular Data tab in REST Debugger and type ‘rates’ into JSON Root Elements and Apply. You will get all exchange rates as given example below;
As given in this example, you can connect and get any REST based data by using free or commercial REST Services such as exchange rates, weather, news and almost anything else you could imagine. If you still have problems setting up the REST Debugger, or if you have connection problems to your REST Web Service, you can also use REST Components to test REST Requests. It is very easy to set up REST components manually with their parameters although the REST Debugger automates this process and allows you to test the connections too. This example may help you about how to use REST Debugger and Components.
If you want to add live exchange rates features to your applications you can sign up to Exchangerates API by registering at exchangeratesapi.io and try it in C++ Builder or Delphi.
C++ Builder is the easiest and fastest C and C++ IDE for building simple or professional applications on the Windows, MacOS, iOS & Android operating systems. It is also easy for beginners to learn with its wide range of samples, tutorials, help files, and LSP support for code. RAD Studio’s C++ Builder version comes with the award-winning VCL framework for high-performance native Windows apps and the powerful FireMonkey (FMX) framework for cross-platform UIs.
There is a free C++ Builder Community Edition for students, beginners, and startups; it can be downloaded from here. For professional developers, there are Professional, Architect, or Enterprise versions of C++ Builder and there is a trial version you can download from here.