Content Types
Unified Content Store Content Types
Content Type |
Description |
Document |
A document is the main and only type of entity which defines the content items using a generic JSON schema. |
Document Structure
The JSON document exchange format defines the format of a single document expected by the Unified Content Store as a JSON schema definition (see JSON Schema Definition).
A single document descriptor consists of:
-
A document ID (Field
id
, TypeString
) - required -
A field holding the Base64 encoded document content (Field
content
, TypeString
) - optional -
An array of metadata entries (Field
metadata
) - optional
Content Field
The content
field is a top-level document property that contains the document’s content value encoded in Base64. This field is optional and can be omitted if the document has no content or if only metadata needs to be stored.
Metadata Structure
Every item of the metadata field consists of three elements:
Name | Property Key | Description |
---|---|---|
Metadata Name |
|
Metadata title (Type |
Metadata Type |
|
Type of the metadata values (Type |
Metadata Values |
|
Array of metadata entries assigned to the document.
This must be an array even if there is just one entry. (Type: |
-
Values must correlate to the type given in the field
type
. Otherwise, the document entry will be rejected during validation. -
Values must be in the range for the appropriate Java data type.
double
values must be formatted with the en-US locale. -
Values for the type
date
must be given as String using the Java format descriptionyyyy-MM-dd’T’HH:mm:ss.SSSZ
.
If multiple metadata fields with the same name are found in the metadata list, the last metadata entry encountered will be used, and any previous entries with the same name will be ignored. While this will not cause the document to be rejected, it is recommended to avoid duplicate metadata field names to ensure predictable behavior. |
JSON Schema Definition
{
"definitions": {
"Document": {
"title": "Document format specification",
"description": "Single document descriptor used to transfer a document into the UCS",
"type": "object",
"required": [ "id" ],
"properties": {
"id": {
"title": "Document id",
"type": "string"
},
"deleted": {
"title": "Document deleted",
"type": "boolean"
},
"metadata": {
"title": "Document metadata",
"description": "Array of metadata connected to the document",
"type": "array",
"items": {
"$ref": "#/definitions/Metadata"
}
},
"content": {
"title": "Document content",
"description": "Document content (Base64 encoded)",
"type": "string"
}
}
},
"Metadata": {
"title": "Metadata entry",
"description": "Single entry of a metadata connected to a document.",
"type": "object",
"required": [ "name", "value" ],
"properties": {
"name": {
"title": "Metadata name",
"type": "string"
},
"type": {
"title": "Value type",
"description": "Type of the metadata value. If defined as \"date\" the value array must contain strings in the format \"yyyy-MM-dd'T'HH:mm:ss.SSSZ\".",
"type": "string",
"enum": [ "string", "date", "int", "double", "long", "boolean" ]
},
"value": {
"title": "Value of metadata",
"description": "Array of metadata values in the format defined by the \"type\" field.",
"type": "array",
"items": {
"type": ["string", "integer", "number", "boolean" ]
}
}
}
}
}
}
JSON Document Example
Based on the JSON schema, the following shows an example of a document’s JSON declaration as accepted by the REST API.
{ "id": "document A",
"metadata": [
{ "name": "Metadata 1",
"type": "string",
"value": ["First String Value", "Second String Value"]},
{ "name": "Metadata 2",
"type": "boolean",
"value": [true]},
{ "name": "Meta Date Values",
"type": "date",
"value": ["2017-10-03T14:32:10.000+0100", "2016-12-04T14:10:59.000+0100"]
},
{ "name": "Single string meta",
"type": "string",
"value": ["Single String Value"]
},
{ "name": "Metadata 4",
"type": "long",
"value": [4711, 42]
},
{ "name": "Metadata 5",
"type": "number",
"value": [3.14159265, 2.7182818284 ]
}
],
"content": "VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZy4="
}