Currencies

Currencies #

A Currency represents the National Unit of Measure issued by a Nation and recognized as a valid Medium of Exchange by all other Nations. There are currently 171 Currencies recognized by the ISO all of which can be handled by the platform.

Properties #

Direct Properties #

PropertyTypeDefinition
Currency CodeStringThe three letter ISO Code that represents the currency
NameStringThe human readeable name of the Currency. If not supplied, the standard ISO name is used

Indirect Properties #

PropertyTypeDefinition
Exchange RatesListTransactional Exchange Rates recorded for the Currency
Closing ratesListThe Translational Exchange Rates recorded for the Currency. These are used during Reporting Period Closing to record Unrealized Forex Differences in Balance Sheet Accounts

Basics #

The only parameter required to record a Currency is the ISO currency code. The name of the Currency will be automatically added if not provided.

Request #

curl --location --request POST 'https://api.microbooks.io/books/v1/currency' \
    --header "Authorization: Bearer <bearer_token>" \
    --data-raw '{
    "currency_code": "USD"
}'
import requests

url = "https://api.microbooks.io/books/v1/currency"
body = {"currency_code": "USD"}
headers = {"Authorization": "Bearer <bearer_token>"}

response = requests.request("POST", url, headers=headers, json=body)

print(response.text)
var request = require('request');
var options = {
    'method': 'POST',
    'url': 'https://api.microbooks.io/books/v1/currency',
    'headers': {'Authorization': 'Bearer <bearer_token>'},
    'body': '{
        "currency_code": "USD", 
    }'
};
request(options, function (error, response) {
    if (error) throw new Error(error);
    console.log(response.body);
});
$client = new Client();
$body = '{
    "currency_code": "USD",
}';
$request = new Request('POST', 'https://api.microbooks.io/books/v1/currency', 
    [headers' => ['Authorization' => 'Bearer <bearer_token>']], 
    $body
);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
var client = new RestClient("https://api.microbooks.io/books/v1/currency");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
var body = "{
    \"currency_code\": \"USD\", 
}";
request.AddParameter("text/plain", body,  ParameterType.RequestBody);
request.AddHeader("Authorization", "Bearer " + <bearer_token>);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);

Response #

{
    "status": "success",
    "message": "Currency: US Dollar (USD) created successfully",
    "resource": {
        "name": "US Dollar",
        "currency_code": "USD",
        "user_id": 1,
        "id": 1
    }
}

Errors #

Below are the Errors that are returned by the Currency Resource.

Detail CodeHTTP StatusNameDefinition
100400Orphaned ItemsCannot recycle the Currency Resource because it has dependent Resources
422422ValidationA field is missing, malformed or not recognised. The field is the key under errors

Errors use the standard error envelope, which also lists the request-level codes (401, 403, 404, 429 and others) that any endpoint can return.