Definitions
In any system, there are certain phrases and principles that need to be defined to make sure that everybody is talking about the same thing.
This is specially important for the data being sent and received: both sender and recipient have to agree on certain formats to make sure the data is handled at both ends.
In the structures and examples a number of prhases are used to describe the data like 'String', 'Integer number', etc.
All these types of data have their own specific format and are described in the table you find below.
Definitions for json structures
Phrase | Meaning | Our (regex) mask |
---|---|---|
String | Anything that could be typed on a keyboard, including: valid UTF-8 tekst, base64 encoded information, etc. | /.*/ |
Key (UUID format) | A valid UUID format: 00000000-0000-0000-0000-000000000000 where any 0 can be a number or (capital) ASCII character | /^[0-9A-Z]{8}-[0-9A-Z]{4}-[0-9A-Z]{4}-[0-9A-Z]{4}-[0-9A-Z]{12}$/ |
Integer number | A valid integer number. Any maximum or minimum is defined in the option. | /^[\-0-9]+$/ |
Real number | A valid decimal number. The decimal point is a . not a comma. Any maximum or minimum is defined in the option. | /^[\-0-9\.]+$/ |
Boolean | A JSON true or false | /^true|false$/ |
Date | A valid date | YYYY-MM-DD |
DateTime | A valid date and time | YYYY-MM-DD HH:MM:SS |
DateTime RFC3339 | This is a standard date and time notation taking timezones into account. All newly created and updated endpoints will move to this format (while ofcourse retaining the old fields for backward compatibility) | YYYY-MM-DDTHH:MM:SS(Z|Txxx) |
A valid email address | Any valid email address at least having the format name@domain.tld | |
url | valid http url | Any valid URL |
price | The same as a 'Real number', but rounded off to 2 decimals. | /^[0-9]+\.[0-9]+$/ |
Country | A valid ISO3 country name, lists are available online (for example NLD). | /^[A-Z]{3}$/ |
Timezone | valid timezone name (for example: Europe/Amsterdam) | /^[a-zA-z]_\/[a-zA-Z]+$/ |
HEX string | A special kind of string, containting hexadecimal numbers | /^[0-9A-F\_]+$/ |
Sublist | A JSON object that has named items. | example: { 'item1' => 'value1', 'item2' => 'value2' }, the values might be an array or sublist. |
Array of single values | Must be able to be evaluated as a JSON array, and each array item must be a simple value (anything of the above, but not another array, object list or sublist). | example: ["value1","value2","value3"...] |
Array of objects | A valid JSON array with valid JSON objects. | Must be able to be evaluated as a JSON array. Each item is a sublist as defined above. |
ID list of objects | Basically the same as a Sublist, but the difference is that each entry is a 'key' or 'id' with an array or sublist object attached to it. | example: {"1":{"name":"test","field":"value"},"2":{"name":"test2","field":"value"} ...} |