Rest Api

Note: Rest Api is a pro feature and to make this work you need have the pro addon plugin “CBX Currency Converter Pro Addon” V1.7.0 or later installed

Status: This page documentation is completed

Last modified: August 17, 2023

There are three rest end points.
1. Settings or default settings values
1. Calculator or Conversion api
2. List or latest rates

We have a postman collection with example for easy understanding.

Api Key(s):
To make the rest api work it will need to set api key(s). To set the api key please check the plugin settings (Dashboard menu Settings -> Currency Converter -> Rest Api (Tab))
To input multiple api key please use comma. Api keys can be set as any text(something like secret word or password or passphrase).

Response Codes
1. api offline = 503
2. api key wrong or missing = 403
3. validation error, wrong inputs = 422
4. ok = 200

01. Get Method – Settings
Endpoint: http://example-site.com/wp-json/cbcurrencyconverter/v1/settings

Headers
x-api-key aLEMGoKzjy2GL34D (example value, as you set in plugin’s setting)
Body formdata
None

Output Example:

<code class="language-json">
{
    "message": "Success. Plugins settings in data.",
    "data": {
        "global_settings": {
            "default_layout": "cal",
            "decimal_point": "2",
            "app_aboutme": "Currency Convert app by Codeboxr.com",
            "app_menus": {
                "1": "cal",
                "2": "list",
                "3": "aboutapp"
            }
        },
        "calculator": {
            "title": "Currency Calculator",
            "default_amount": "1",
            "enabled_from_currencies": {
                "1": "USD"
            },
            "from_currency": "USD",
            "enabled_to_currencies": {
                "1": "AUD",
                "2": "BDT",
                "3": "CAD",
                "4": "GBP"
            },
            "to_currency": "CAD"
        },
        "list": {
            "title": "List of Currency",
            "default_amount": "1",
            "from_currency": "USD",
            "to_currencies": {
                "1": "AUD",
                "2": "BDT",
                "3": "CAD",
                "4": "GBP"
            }
        }
    },
    "code": 200
}
</code>

02. Post Method – Calculator
Endpoint: http://example-site.com/wp-json/cbcurrencyconverter/v1/calculator

Headers
x-api-key aLEMGoKzjy2GL34D (example value, as you set in plugin’s setting)
Body formdata
from USD
to BDT
amount 1

Output Example:

<code class="language-json">
{
    "message": "Success. Rate data found.",
    "data": "107.12",
    "code": 200
}
</code>

02. Post Method – List
Endpoint: http://example-site.com/wp-json/cbcurrencyconverter/v1/list

Headers
x-api-key aLEMGoKzjy2GL34D (example value, as you set in plugin’s setting)
Body formdata
from USD
to BDT,CAD
amount 1

Output Example:

<code class="language-json">
{
    "message": "Successful",
    "data": {
        "BDT": "107.12",
        "CAD": "1.36"
    },
    "code": 200
}
</code>