Thousands of people are instantaneously performing foreign exchange buying and selling transactions through a single application. The applications that people use provide services to users around the world by supporting official currencies around the world. In this way , organic traffic is provided to the applications . These applications generally serve their users by using services that provide Currency Exchange API service.
One of the most popular services offering Currency Exchange API is Fixer API. Fixer API is preferred by large companies such as Microsoft, Samsung, Berskha, and it returns accurate and reliable information in JSON format in just milliseconds.
Fixer API also offers historical data service with an investor-friendly approach. It helps you to shape a large data pool within the framework of your investments.
In this article, we will take a look at how Fixer API, which provides Currency Exchange API, is quickly integrated into Python, PHP Ruby and Javascript languages. So let’s start.
Fixer API integration
You can quickly integrate the Fixer API, which provides Currency Exchange API service, into your applications. Before integration, you need to choose a suitable package from the Fixer API website and obtain an API key. With this API key, you can quickly integrate the Fixer API service into your application.
Integration to Python Programming Language
After obtaining the API key to integrate with the Fixer API, we can paste the following code block into the Python project and run it.
import http.client conn = http.client.HTTPSConnection(“data.fixer.io”) payload = ” headers = {} conn.request(“GET”, “/api/latest?access_key=c0*****f”, payload, headers) res = conn.getresponse() data = res.read() print(data.decode(“utf-8”)) |
When this code runs, the response is as follows.
{ “success”: true, “timestamp”: 1649499123, “base”: “EUR”, “date”: “2022-04-09”, “rates”: { “AED”: 3.994736, “AFN”: 95.707667, “ALL”: 121.269795, “AMD”: 517.352591, “ANG”: 1.960959, “AOA”: 477.106204, “ARS”: 121.989028, “AUD”: 1.460809, “AWG”: 1.956561, “AZN”: 1.853208, “BAM”: 1.954792, “BBD”: 2.196834, “BDT”: 93.875858, “BGN”: 1.955968, “BHD”: 0.410156, “BIF”: 2187.672338, “BMD”: 1.087583, [170 world currencies] } } |
The answer returns the currency value of 170 countries around the world as EURO.
Integration to PHP Programming Language
With this PHP code, we can see the values of GBP, AUD, USD, PLN, MXN, TRY corresponding to EUR currency via Fixer API.
$access_key = ‘c0*****f’; $ch = curl_init(‘http://data.fixer.io/api/latest?access_key=’.$access_key.‘&symbols=GBP,AUD,USD,PLN,MXN,TRY’); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $json = curl_exec($ch); curl_close($ch); $api_result = json_decode($json, true); echo $api_result; |
When this code runs, the response is as follows.
{ “success”: true, “timestamp”: 1649499123, “base”: “EUR”, “date”: “2022-04-09”, “rates”: { “GBP”: 0.835426, “AUD”: 1.460809, “USD”: 1.087583, “PLN”: 4.633889, “MXN”: 21.791984, “TRY”: 16.040868 } } |
Integration to Ruby Programming Language
With the Ruby code below, the value of EUR currency to GBP, AUD, USD, PLN, MXN currencies on 2013-03-16 was queried
require “uri” require “net/http” url = URI(“http://data.fixer.io/api/2013-03-16?access_key=c0****f&symbols=GBP,AUD,USD,PLN,MXN,TRY”) http = Net::HTTP.new(url.host, url.port); request = Net::HTTP::Get.new(url) response = http.request(request) puts response.read_body |
When this code runs, the response is as follows.
{ “success”: true, “timestamp”: 1363478399, “historical”: true, “base”: “EUR”, “date”: “2013-03-16”, “rates”: { “GBP”: 0.865184, “AUD”: 1.256333, “USD”: 1.307716, “PLN”: 4.150819, “MXN”: 16.259128, “TRY”: 2.362968 } } |
Integration to Javascript Programming Language
With the following Javascript code, the value of the EURO currency in 170 official currencies is instantly displayed.
var settings = { “url”: “http://data.fixer.io/api/latest?access_key=c0*****f”, “method”: “GET”, “timeout”: 0, }; $.ajax(settings).done(function (response) { console.log(response); }); |
When this code runs, the response is as follows.
{ “success”: true, “timestamp”: 1649499123, “base”: “EUR”, “date”: “2022-04-09”, “rates”: { “AED”: 3.994736, “AFN”: 95.707667, “ALL”: 121.269795, “AMD”: 517.352591, “ANG”: 1.960959, “AOA”: 477.106204, “ARS”: 121.989028, “AUD”: 1.460809, “AWG”: 1.956561, “AZN”: 1.853208, “BAM”: 1.954792, “BBD”: 2.196834, “BDT”: 93.875858, “BGN”: 1.955968, “BHD”: 0.410156, “BIF”: 2187.672338, “BMD”: 1.087583, “BND”: 1.482413, “BOB”: 7.480229, “BRL”: 5.111208, “BSD”: 1.088022, “BTC”: 2.5629296e-5, “BTN”: 82.505895, “BWP”: 12.585818, “BYN”: 3.547017, “BYR”: 21316.618359, “BZD”: 2.193136, [170 world currencies] } } |
Conclusion
You can serve international users by integrating Fixer API, which provides a reliable and fast integrated Currency Exchange API, into your application.
Recent Comments