Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Overview

This page contains screen scribbles for the Editor GUI implemented in wcm.io for the Sling Context-Aware Configuration.

...

No Format
=== Configuration Editor: <Config Name> ====

[ Save ]  [ Cancel ]

Context Path: /x/y/z


--- Configuration: item1 ---
| Property    | Value   | Description   | Inherited   | Overwritten
| Param 1     | 123     | (i)           | [x]         | [ ]
| Param 2     | abc     | (i)           | [ ]         | [ ]

[ Delete ]

--- Configuration: item2 ---
| Property    | Value   | Description   | Inherited   | Overwritten
| Param 1     | 123     | (i)           | [x]         | [ ]

[ Delete ]


[ Add ]


Configuration Editor HTTP API

Configuration Names

URL: <resource-path>.configNames.json

Returns the current context path, and an array with all configuration names and metadata.

Example response:

Code Block
javascript
javascript
{
  "contextPath": "/content/path",
  "configNames": [
    {
      "configName": "configName",
      "label": "Sample Configuration",
      "description": "This is a sample configuration.",
      "collection": false,
      "exists": true
    },
    {
      "configName": "configNameList",
      "label": "Sample Configuration List",
      "description": "This is a sample configuration list.",
      "collection": true,
      "exists": true
    }
  ]
}

Read Configuration Data

URL: <resource-path>.configData.json?configName=<configName>[&collection=true]

Use the configName as parameter for the configPersist URL when posting back the changed configuration data.

Example response for singleton config:

Code Block
javascript
javascript
{
  "configName": "configName",
  "properties": [
    {
      "name": "stringParam",
      "value": "This is an example string value",
      "effectiveValue": "This is an example string value",
      "configSourcePath": "/conf/contextaware-config-sample/sample/sling:configs/io.wcm.caconfig.sample.config.ConfigSample",
      "default": false,
      "inherited": false,
      "overridden": false,
      "metadata": {
        "type": "String",
        "label": "String Param",
        "description": "This is a string parameter in the singleton configuration."
      }
    },
    {
      "name": "stringArrayParam",
      "effectiveValue": [
        "value1",
        "value2"
      ],
      "default": true,
      "inherited": false,
      "overridden": false,
      "metadata": {
        "type": "String",
        "multivalue": true,
        "defaultValue": [
          "value1",
          "value2"
        ],
        "label": "String Array Param"
      }
    }
  ]
}

Example response for collection config:

Code Block
javascript
javascript
{
  "configName": "configNameList",
  "properties": {
    "colProp1": "value1"
  },
  "items": [
    {
      "configName": "configNameList",
      "collectionItemName": "item1",
      "properties": [
        {
          "name": "stringParam",
          "value": "Value of item1",
          "effectiveValue": "Value of item1",
          "configSourcePath": "/conf/contextaware-config-sample/sample/sling:configs/io.wcm.caconfig.sample.config.ConfigSampleList/item1",
          "default": false,
          "inherited": false,
          "overridden": false,
          "metadata": {
            "type": "String",
            "label": "String Param",
            "description": "This is a string parameter within the configuration list."
          }
        }
      ]
    },
    {
      "configName": "configNameList",
      "collectionItemName": "item2",
      "properties": [
        {
          "name": "stringParam",
          "value": "Value of item2",
          "effectiveValue": "Value of item2",
          "configSourcePath": "/conf/contextaware-config-sample/sample/sling:configs/io.wcm.caconfig.sample.config.ConfigSampleList/item2",
          "default": false,
          "inherited": false,
          "overridden": false,
          "metadata": {
            "type": "String",
            "label": "String Param",
            "description": "This is a string parameter within the configuration list."
          }
        }
      ]
    }
  ]
}

In case of nested configurations the property object contains a nestedConfig (singleton) or nestedConfigCollection (collection) object, which content has the same structure as shown above. Each nested configuration has it's own configName which can be used for posting as well.

Persist Configuration Data

URL: <resource-path>.configPersist.json?configName=<configName>[&collection=true]

Use POST method.

Post singleton configuration with a JSON body like this:

Code Block
languagejs
{"properties": {
  "prop1": "value1",
  "prop2": 55,
  "prop3": true,
  "prop4": ["value1","value2"]
}}


Post configuration collections with a JSON body like this:

Code Block
languagejs
{
  "properties": {"colProp", "value1"},
  "items": [
    {"collectionItemName": "item1", "properties": {
      "prop1": "value1",
      "prop2": 55,
      "prop3": true,
      "prop4": ["value1","value2"]
    }},
    {"collectionItemName": "item2", "properties": {
      "prop1": "value2"
    }}
  ]
}


No nested configurations are allowed when posting. Post them individually.