Skip to main content

Content

Attribute supports various content defined by contentType.

Attribute types

For more details about Attribute types and contentType, see Attributes.

Content properties

Each content type must extend, based on the attribute version, either BaseAttributeContentV2 or BaseAttributeContentV3 which are abstracted from AttributeContent.

The content has the following properties defined and inherited from BaseAttributeContentV2:

PropertyTypeShort descriptionRequired
referencestringReference that can be used for the content value. It is useful especially when the data contains an object, or any other more complex data structureNo
dataAttributeContentThe value of the content, depending on the contentType from supported AttributeContentTypeYes

The content has the following properties defined and inherited from BaseAttributeContentV3:

PropertyTypeShort descriptionRequired
referencestringReference that can be used for the content value. It is useful especially when the data contains an object, or any other more complex data structureNo
dataAttributeContentThe value of the content, depending on the contentType from supported AttributeContentTypeYes
contentTypeAttributeContentTypeThe type of the content, must match the content type of attribute definitionYes

Supported content types

Use V3 content classes

V2 content classes are deprecated. New implementations should use V3 content classes (e.g., StringAttributeContentV3 instead of StringAttributeContentV2). The V2-only content types SECRET and CREDENTIAL are replaced by RESOURCE OBJECT in V3.

Supported content types are defined in AttributeContentType. The following content types are available and supported:

AttributeContentTypeClass V2Class V3Data
STRINGStringAttributeContentV2StringAttributeContentV3string
INTEGERIntegerAttributeContentV2IntegerAttributeContentV3integer
SECRETSecretAttributeContentV2N/ASecretAttributeContentData
FILEFileAttributeContentV2FileAttributeContentV3FileAttributeContentData
BOOLEANBooleanAttributeContentV2BooleanAttributeContentV3boolean
TEXTTextAttributeContentV2TextAttributeContentV3string
CODEBLOCKCodeBlockAttributeContentV2CodeBlockAttributeContentV3CodeBlockAttributeContentData
FLOATFloatAttributeContentV2FloatAttributeContentV3float
DATEDateAttributeContentV2DateAttributeContentV3date
DATETIMEDateTimeAttributeContentV2DateTimeAttributeContentV3datetime
TIMETimeAttributeContentV2TimeAttributeContentV3time
CREDENTIALCredentialAttributeContentV2N/ACredentialAttributeContentData
OBJECTObjectAttributeContentV2ObjectAttributeContentV3object
RESOURCE OBJECTN/AResourceObjectContentResourceObjectContentData
Multiple content types in one Attribute

One Attribute can define only one contentType. Multiple different content types for one Attribute is not supported.

Content type samples

The table below shows the AttributeContentType and the sample for each type and version.

AttributeContentType

Content samples

STRING

v2
{
"content": [
{
"reference": "string",
"data": "string"
}
]
}
v3
{
"content": [
{
"reference": "string",
"data": "string",
"contentType": "string"
}
]
}

INTEGER

v2
{
"content": [
{
"reference": "string",
"data": 12345
}
]
}
v3
{
"content": [
{
"reference": "string",
"data": 12345,
"contentType": "integer"
}
]
}

SECRET

v2
{
"content": [
{
"reference": "string",
"data": {
"secret": "secret"
}
}
]
}
V2-only

SECRET is V2-only. In V3, use RESOURCE OBJECT with AttributeResource.SECRET instead.

SECRET is handled by the platform securely, and its value will never be presented to a client once defined.

FILE

v2
{
"content": [
{
"reference": "string",
"data": {
"data": "base64-encoded content of the file",
"fileName": "name of the file",
"mimeType": "type of the file"
}
}
]
}
v3
{
"content": [
{
"reference": "string",
"data": {
"data": "base64-encoded content of the file",
"fileName": "name of the file",
"mimeType": "type of the file"
},
"contentType": "file"
}
]
}

FILE type can be specifically handled based on the mimeType.

BOOLEAN

v2
{
"content": [
{
"reference": "string",
"data": true
}
]
}
v3
{
"content": [
{
"reference": "string",
"data": true,
"contentType": "boolean"
}
]
}

CREDENTIAL

v2
{
"content": [
{
"reference": "identification of Credential",
"data": {
"name": "string",
"uuid": "UUID of the Credential",
"kind": "kind of the Credential",
"attributes": [
...list of Credential Attributes
]
"enabled": true,
"connectorUuid": "UUID of the Credential Provider Connector",
"connectorName": "name of the Credential Provider Connector"
}
}
]
}
V2-only

CREDENTIAL is V2-only. In V3, use RESOURCE OBJECT with AttributeResource.CREDENTIAL instead.

CREDENTIAL is a special purpose type that is handled by the platform for Connectors that needs to use the credential for authentication and authorization to technology, for example, API Key, username/password, and any other Credential.

DATE

v2
{
"content": [
{
"reference": "string",
"data": "2022-11-30"
}
]
}
v3
{
"content": [
{
"reference": "string",
"data": "2022-11-30",
"contentType": "date"
}
]
}

DATE should be in the format yyyy-MM-dd.

FLOAT

v2
{
"content": [
{
"reference": "string",
"data": 12.4487211
}
]
}
v3
{
"content": [
{
"reference": "string",
"data": 12.4487211,
"contentType": "float"
}
]
}

OBJECT

v2
{
"content": [
{
"reference": "identification of Object",
"data": {
... any JSON object
}
}
]
}
v3
{
"content": [
{
"reference": "identification of Object",
"data": {
... any JSON object
},
"contentType": "object"
}
]
}

OBJECT type provides a flexible way how to work with the custom objects within the Attributes and Callbacks.

TEXT

v2
{
"content": [
{
"reference": "string",
"data": "long text"
}
]
}
v3
{
"content": [
{
"reference": "string",
"data": "long text",
"contentType": "text"
}
]
}

TEXT supports long string/text data to be processed.

CODEBLOCK

v2
{
"content": [
{
"reference": "string",
"data": {
"language": "string",
"code": "Block of the code in Base64. Formatting of the code is specified by variable language"
}
}
]
}
v3
{
"content": [
{
"reference": "string",
"data": {
"language": "string",
"code": "Block of the code in Base64. Formatting of the code is specified by variable language"
},
"contentType": "codeblock"
}
]
}

CODEBLOCK supports scripts from various languages. For example, to store a simple addition method written in C#

public void Add(string a, string b) {
return a + b;
}

you would send the following content

v2
{
"content": [
{
"reference": "sample",
"data": {
"language": "csharp",
"code": "cHVibGljIHZvaWQgQWRkKHN0cmluZyBhLCBzdHJpbmcgYikgewogIHJldHVybiBhICsgYjsKfQ=="
}
}
]
}
v3
{
"content": [
{
"reference": "sample",
"data": {
"language": "csharp",
"code": "cHVibGljIHZvaWQgQWRkKHN0cmluZyBhLCBzdHJpbmcgYikgewogIHJldHVybiBhICsgYjsKfQ=="
},
"contentType": "codeblock"
}
]
}

TIME

v2
{
"content": [
{
"reference": "string",
"data": "11:45:32"
}
]
}
v3
{
"content": [
{
"reference": "string",
"data": "11:45:32",
"contentType": "time"
}
]
}

TIME should be in the format HH:mm:ss.

DATETIME

v2
{
"content": [
{
"reference": "string",
"data": "2011-12-03T10:15:30+01:00"
}
]
}
v3
{
"content": [
{
"reference": "string",
"data": "2011-12-03T10:15:30+01:00",
"contentType": "datetime"
}
]
}

DATETIME should be in the format yyyy-MM-dd'T'HH:mm:ss.SSSXXX, which is ISO-8601 extended offset date-time format.

RESOURCE OBJECT

v3
{
"content": [
{
"reference": "My Credential",
"data": {
"uuid": "c18e6466-e435-4fdd-97e4-02f4f2c6ceee",
"name": "My Credential",
"resource": "credentials"
},
"contentType": "resource"
}
]
}

RESOURCE OBJECT is a V3-only content type used to reference platform resource objects (e.g., Credential, Certificate, Authority). It replaces the V2-only SECRET and CREDENTIAL content types. The following resources are supported:

ResourceData
CertificateResourceCertificateContentData
CredentialResourceSimpleContentData
AuthorityResourceSimpleContentData
EntityResourceSimpleContentData
LocationResourceSimpleContentData
SecretResourceSecretContentData

An Attribute with RESOURCE OBJECT content type must also specify the resource property in its properties and define a corresponding Resource Callback.

Content model

The following diagram represents the content model inherited from the AttributeContent. Details can be found in the CZERTAINLY Interfaces repository.

Version-specific content types

Content types highlighted in red (SecretAttributeContentV2, CredentialAttributeContentV2) are V2-only. The type highlighted in green (ResourceObjectContent) is V3-only and replaces the V2 SECRET and CREDENTIAL content types. All other content types exist in both V2 and V3.