Field types¶
Based on the assumption that the field types are part of the API contract, we understand that they need to be clear, objective and structured.
Therefore, all projects included in this portal will use these standard field types.
Date/time¶
In date/time fields we use the ISO 8601 standard. If this is not possible and there is a strong justification, use the UTC timezone.
Examples:
Field type | Format | Timezone |
---|---|---|
date |
YYYY-MM-DD | Server location |
time |
hh-mm-ssZ | UTC |
date/time |
YYYY-MM-DDThh:mm:ssZ | UTC |
Currency¶
In monetary value fields, indicate what the currency is via the currency
field. This field must be filled in with acronyms defined in the standard ISO 4217 (Always use codes with capital letters).
Examples:
Currency | Monogram |
---|---|
real | BRL |
american dollar | USD |
euro | EUR |
Note
For other currency types, see ISO codes for currencies.
The normalizer
field should be used to normalize a quantity to currency
units. Consider the following object:
We have amount = 100, normalizer=100 and currency=USD. To interpret the values we have to do the following operation:
currency_units = money.amount / money.normalizer
currency_units = 100 / 100
currency_units = 1
> 1 USD
In the example above, the normalizer being 100 means that the amount value was in cents and that to return to a currency unit, in this case dollars, the amount value must be divided by 100.
UUID¶
In fields of type UUID we use the version 4 standard, described in RFC 4122.
Example: a04ab1cf-3bac-419a-a3e1-da615e242bd2
More details about this standard can be found here.
Object¶
In object fields we use the JSON structure following the RFC 8259 standard, more details about this standard can be found here.