Get started
https://code3.dev/ex/
The c3 Exchange API provides you with up to date converison rates for all world currencies. Free to use.
GET request
# CURL request example
curl --location --request GET 'https://code3.dev/ex/?from=EUR&to=USD&amount=100'
// JavaScript FETCH example
var requestOptions = {
method: 'GET',
redirect: 'follow'
};
fetch("https://code3.dev/ex/?from=EUR&to=USD&amount=100", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
// jQuery AJAX example
var settings = {
"url": "https://code3.dev/ex/?from=EUR&to=USD&amount=100",
"method": "GET",
"timeout": 0,
};
$.ajax(settings).done(function (response) {
console.log(response);
});
// node.js Axios example
var axios = require('axios');
var config = {
method: 'get',
url: 'https://code3.dev/ex/?from=EUR&to=USD&amount=100',
headers: { }
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
// PHP cURL example
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://code3.dev/ex/?from=EUR&to=USD&amount=100',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
// Java OkHttp Client example
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://code3.dev/ex/?from=EUR&to=USD&amount=100")
.method("GET", body)
.build();
Response response = client.newCall(request).execute();
# Python http.client example
import http.client
conn = http.client.HTTPSConnection("code3.dev")
payload = ''
headers = {}
conn.request("GET", "/ex/?from=EUR&to=USD&amount=100", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
To convert currency you need to make a GET call to the following url :
https://code3.dev/ex/
/*** RESULT ***/
{
"from": "EUR",
"to": "USD",
"amount": "100",
"converted": 106.49048880199265
}
Query Parameters
Field | Type | Description |
---|---|---|
from | String | mandatory ISO 4217 currency code for the currency you want to change money from |
to | String | mandatory ISO 4217 currency code for the currency you want to change money to |
amount | Float | mandatory amount of money you would like to exchange (ex: 23.14) |
Errors
Code | Meaning |
---|---|
400 | Some parameters are missing. This error appears when you don't pass every mandatory parameter. |