Content Property

The purpose of this module is to make the data inside content properties available to CQL search so that add-on vendors can search for content they have set data on via CQL.

Content properties are one of the forms of persistence available for Confluence Connect add-ons, allowing you to store key-value pairs against a piece of content, where the value must be well formed JSON. Content Properties are stored as JSON objects, and allow you to track extra information that your add-on needs, without the use of a backing data-store. Values from these JSON objects can be extracted, indexed and made available to CQL queries.

Using Content Properties

To start creating and manipulating content properties, you don't need to declare anything in your descriptor. Just use the REST API to store your JSON data against a piece of content.

To integrate with search, you'll need to define some extractions to declare what fields and nested data you want to be indexable by Confluence. You can also optionally define an alias for simpler CQL querying, and UI support for your fields to be filterable by users on the search screen and in the CQL query builder.

Once you've done that, you can use CQL to query content based on your custom content property.

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{
  "confluenceContentProperties": [
    {
      "keyConfigurations": [
        {
          "propertyKey": "myFirstAddon_attachment",
          "extractions": [
            {
              "objectName": "attachment.size",
              "type": "number"
            },
            {
              "objectName": "attachment.type",
              "type": "string",
              "alias": "myFirstAddon_contentType",
              "uiSupport": {
                "defaultOperator": "~",
                "name": {
                  "value": "Content Type",
                  "i18n": "attachment.type.name"
                },
                "tooltip": {
                  "value": "Content Type Tooltip",
                  "i18n": "attachment.type.tooltip"
                },
                "dataUri": "/data/content-types",
                "valueType": "string"
              }
            },
            {
              "objectName": "attachment.updated",
              "type": "date"
            }
          ]
        }
      ],
      "name": {
        "value": "Attachment Index Document"
      }
    }
  ]
}

Properties

key
Type
Max length
100
Required
Yes
Pattern
^[a-zA-Z0-9-]+$
Description

A key to identify this module.

This key must be unique relative to the add on, with the exception of Confluence macros: Their keys need to be globally unique.

Keys must only contain alphanumeric characters and dashes.

The key is used to generate the url to your add-on's module. The url is generated as a combination of your add-on key and module key. For example, an add-on which looks like:

{ "key": "my-addon", "modules": { "configurePage": { "key": "configure-me", } } }

Will have a configuration page module with a URL of /plugins/servlet/ac/my-addon/configure-me.


name
Type
Required
Yes
Description

A human readable name.

Represents a string that can be resolved via a localization properties file. You can use the same i18n Property key and value in multiple places if you like, but identical keys must have identical values.

Example

1
2
3
4
{
  "value": "My text"
}

Properties

value
Type
Max length
1500
Required
Yes
Description

The human-readable default value. This will be used if no translation exists. Only the following HTML tags are supported: b, i, strong, em, and code.

i18n
Type
Max length
300
Description

The localization key for the human-readable value. Translations for the keys are defined at the top level of the add-on descriptor.


keyConfigurations
Type
Description

A Content Property Index Key Configuration defines which values from your JSON content property object should be indexed and made available to the CQL search syntax.


Rate this page: