Get real-time exchange rate for the Algerian Dinar in common square currencies.
GET https//square.codz.dev/api/currencies
Parameter | Type | Description |
---|---|---|
api_key |
string |
Required. Your API key |
GET https//square.codz.dev/api/convert
Parameter | Type | Description |
---|---|---|
api_key |
string |
Required. Your API key |
from |
string |
Required. Currency ISO code (from currencies) |
type |
string |
Required. "sell" or "buy" |
amount |
float |
The amount you want to convert |
- You can perform API calls via POST requests too.
For JavaScript, install square-codz with npm
npm install square-codz
Then import it
const squareConverter = require('square-codz');
const apiKey = 'YOUR_API_KEY';
squareConverter.convertCurrency(apiKey, 100, 'EUR', 'buy')
.then(result => {
console.log('Test convertCurrency - Success:', result);
})
.catch(error => {
console.error('Test convertCurrency - Error:', error.message);
});
// Test de la fonction getCurrencies
squareConverter.getCurrencies(apiKey)
.then(currencies => {
console.log('Test getCurrencies - Success:', currencies);
})
.catch(error => {
console.error('Test getCurrencies - Error:', error.message);
});
You can simply perform GET/POST calls to the endpoint https://square.codz.dev/api/
Example in python :
import requests
# URL of the endpoint
url = 'https://square.codz.dev/api/convert'
# Request data
data = {
'api_key': 'YOUR_API_KEY',
'amount': 100,
'from': 'EUR',
'price': 'buy' # or 'sell'
}
try:
# Perform the POST request
response = requests.post(url, params=data)
# Check the response status
if response.status_code == 200:
# Display the server response
print('Server response:', response.json())
else:
# Display the error if the request failed
print('Request failed. Error code:', response.status_code)
except Exception as e:
# Display an error if the request encounters an exception
print('Error during the request:', str(e))
Currencies : You will get an array of currencies ISO codes
{
"currencies":
["EUR","USD","GBP","CAD","CHF","TRY","CNY","EAD","MAD","TND","SAR"],
"success":true
}
Convert :
{
"amount":12,
"currency":"EUR",
"rate":"237.00",
"result":"2844.00",
"success":true
}
From the website https://codz.dev
No, purchasing a monthly-cost API key will give you an unlimited access