Whilst we strive in our APIs to make as many data points as possible into first-class citizens - i.e. they have their own dedicated named attribute - the nature of the data we hold and process means that it is impossible to do this in any sane fashion.
To that end, many of our structures contain an additional array of extra data make up of loosely typed key-value pairs (KVPs).
We call them loosely typed as all values are stored and represented as strings, but you can define a type in order to provide some hints as to how the data may be treated. Unless specifically stated though, there is no rigorous enforcement of this, so do not expect it.
KVP Types are used to describe the contents of the KVP data (full list below). There is NO enforcement of types on values of any kind - ultimately, they will be treated as strings. HOWEVER, they do serve as a guide for developers as to the content.
The general. and raw. types are pretty much what they say on the tin. They're used to hold generic or raw/binary data.
All raw.* fields will be base64 encoded so as to not interfere with JSON structuring. These are useful for returning/storing larger quantities of data that doesn't necessarily require processing now, or may be useful to a calling client.
The id. and pii. are used to indicate that this is data that can potentially be used to create new document objects, or entities. They should also be treated with the utmost care and attention when it comes to securing them too.
id.external can be used to capture an object's ID on an external service, and can potentially be searchable in the index
Note - This is different from a result.id.
all id.external KVPs that are attached to an entity’s extraData KVP array will also be indexed and can be used to search for the entity using the /search API. More on this later.
defunct is used to mark an existing KVP deleted when the value must be retained, for example for audit purposes.
result.* are used to capture response codes and transaction IDs from external services
error.* types can be used when processing a document that returns an error, but doesn't necessarily require a full blown error response.
transient.* types will be accepted for processing, but only on the initial call to the service.
NOTE: Transient types are not saved and are only active for the life of an individual call.
They're good for passing sensitive data that is used once and once only.
Full List of Valid kvpTypes
Updated 4 months ago