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 180 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 = {"name": "Acme Inc", "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 Dollars (USD) created successfully",
    "resource": {
        "name": "US Dollars",
        "currency_code": "USD",
        "user_id": 1,
        "id": 1
    }
}

Errors #

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

Detail CodeNameDefinition
100Orphaned ItemsCannot recycle the Currency Resource because it has dependent Resources