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

Learn To Use ExchangeRates API With REST In C++ Builder

Do you want to add live exchange rates features to your applications? You can easily get live exchange rates in our C++ Builder and Delphi applications by using ExchangeRates API from the exchangeratesapi.io that is free for 250 requests monthly. It is very easy to set up and get data in JSON format, which means we can easily use the REST framework to connect this data.

If you’re wondering what a C++ Builder is, it is a C++ software that allows you to build Native Windows C++ apps and iOS apps 10x faster with less code. It also includes an HTTP and REST client library that invokes REST services, as well as AWS and Azure components that can be used to build exchange rate features into your applications.

ExchangeRates API

Exchangerates API is delivering exchanging rates data live for more than 170 world currencies, with over 15 exchange rate data sources, It has several endpoints, where each of them serves a different purpose, use case. These endpoints have functionalities like receiving the latest exchange rates information for a specific set, or all currencies; conversion from one to another currency; receiving data Time-series for multiple or one currencies, and preserving the API daily for the fluctuation data.

Exchangerates API can be registered from exchangeratesapi.io and it has an API structure that has a unique identifier as an API key that gets passed into the API as an URL parameter access_key. This parameter serves as a unique identifying authentication with the Exchangerates API. So there is a limit (currently 250) to requests for free use. The API comes with several endpoints where each of them provides different functionality. If you purchase with a subscription plan, every paid subscription plan on Exchangerates.io is with 256-bit SSL encryption. Simply use the HTTPS protocol instead of HTTP in order to connect to the API through SS

The JSONP Callbacks is a feature included in the Exchangerates API. With this feature, we can specify the function name and send it into the API’s callback GET parameter and make the API respond to your request with the API response wrapped in that function.


REST (Representational State Transfer) is a connectivity method that allows to get and post data to create interactive applications that use Web Services. REST uses a subset of HTTP. A Web service that uses this REST data transfer architecture is called a RESTful. This web service must provide its web resources in a text form and this service also allows contents to be read and modified with a stateless protocol and a predefined set of operations. REST is a new modern data transfer architecture that allows interoperability between the computer systems on the Internet that provide these services. REST is Backend as a Service (BaaS) can be used in REST Server or REST Client applications, it is an alternative to SOAP to access a Web service. client tutorial shows how to use the REST Client Library for accessing REST-based web services (REST stands for Representational State Transfer).

In C++ and Delphi , the REST library is available for all platforms that are supported by both of them. The REST Library framework focuses on JSON as the representation format. XML is not explicitly supported.

C++ Builder has many connectivity options like FireDAC SQL Connections to InterBase, IB Express, MSSQL, MySQL, PostgreSQL, SQLite, …; or TCP/IP Connections and many other connectivity options. C++ Builder has also REST-based connectivity as a Client or as a Server that provides you to do REST connections by the REST components that come with RAD Studio officially.

REST Debugger

We can easily set up the components by using REST Debugger Tool in RAD Studio (C++ Builder or Delphi). You can launch REST Debugger from the Tools menu of RAD StudioThe Embarcadero REST Debugger(The Latest version is 10.4.2) empowers developers to explore, test, and ultimately understand how a RESTful web service works. 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.

REST Debugger allows you to test your connections easily, you can easily 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.

In RAD Studio there is a good tool REST Debugger to test REST Requests (Gets, Posts, …) and it is very easy to automatically set up the REST components with their parameters.

Setting ExchangeRates API

Exchangerates API is very simple, here are the steps,

  1. Sign Up to Exchangerates API can registered from exchangeratesapi.io
  2. Get your API Access Key from the https://manage.exchangeratesapi.io/dashboard  and simply attach your unique Access Key to one of the endpoints (here latest) as a query parameter:
    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, fluctuation) through which you can access different kinds of data, all starting out with this Base URL.
  3. Integrate into your application
    Now you can test your connection with REST Debugger or with your REST Client applications.

Connecting and Setting Components with the REST Debugger

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 base 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;

rest debugger2

One of the great feature of REST Debugger setups all components and features for your C++ Builder application. Just press to ‘Copy Components’, paste it to your form design.

REST Connection by using REST Debugger Settings

Easily a REST connection can be done by using REST components and REST Debugger in C++ Builder.

  1. Create a new Multi-Device C++ Builder application, save all unit and project files to a folder (i.e ExchangeRatesAPI )
  2. Set your ExchangeRates API Registration on their web page and use REST Debugger as described above.
    If you copied components by using REST Debugger as given above, paste them to your form, and arrange their positions to see their names.
  3. Add a Button (TButton) and a Memo (TMemo) component to see all JSON data.
  4. Double click to Button1, and modify as below,

If you run your application you will see that it gets all data about all exchange rates in JSON format.
If you don’t want to use components copied by the REST Debugger, you can also manually follow the Tutorial using the REST Client Library from here

REST Connection with REST Components

Easily a REST connection can be done by using REST components in C++ Builder.

  1. Create a new Multi-Device C++ Builder application, save all unit and project files to a folder (i.e ExchangeRatesAPI )
  2. Add a Button (TButton) and a Memo (TMemo) component to see all JSON data.
  3. Drag RESTClient (TRESTClient , RESTRequest (TRESTRequest) and RESTResponse (TRESTResponse) and arrange their positions to see their names.
  4. Click to RESTClient1, and on the Object Inspector window,
    Set your ExchangeRates API Registration on their web page as described above
    As described in https://exchangeratesapi.io/documentation/ document
    set its BaseURL property to “http://api.exchangeratesapi.io/v1” or you can modify at in code as below,
    Double click to its Params and add two parameters; Endpoint with the Value=latest and access_key with the Value = YOUR API KEY parameters as below here,
rest params 8466406

5. Double click to Button1 and add RESTClient, RESTRequest parameters and retrieve results from RESTResponse as below,

Here the commented first 3 lines can be modified according your setup if you didn’t set it from the components properties as given steps above.

Sign up to Exchangerates API, it can registered from exchangeratesapi.io and try it in C++ Builder, it is also possible in Delphi too.

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. There is a free C++ Builder Community Edition for students, beginners and startups, it can be download from here and the professional developers can use the Professional, Architect or Enterprise versions of C++ Builder which has trial version and can be downloaded from here.

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

Dr. Yilmaz Yoru has 35+ years of coding with more than 30+ programming languages, mostly C++ on Windows, Android, Mac-OS, iOS, Linux, and some other operating systems. He graduated and received his MSc and PhD degrees from the Department of Mechanical Engineering of Eskisehir Osmangazi University. He is the founder and CEO of ESENJA LLC Company. His interests are Programming, Thermodynamics, Fluid Mechanics, Artificial Intelligence, 2D & 3D Designs, and high-end innovations.


Leave a Reply

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