Uploaded image for project: 'Confluence Cloud'
  1. Confluence Cloud
  2. CONFCLOUD-71704

Multiple content properties with the same key

XMLWordPrintable

      Issue Summary

      It seems Confluence allows multiple content properties with the same key despite the API docs indicating that keys are unique. As per https://community.developer.atlassian.com/t/duplicate-keys-in-content-property/45618, a particular customer has the following scenario:

       

      {
          {
            "id": "XXXXXXXXX",
            "key": "key-example",
            "value": [ ... 
            ],
            "version": {
              "when": "2021-01-23T12:58:55.368Z",
              "message": "",
              "number": 8,
              "minorEdit": false
            },
            "_expandable": {
              "content": "/rest/api/content/XXXXXXXX"
            },
            "_links": {
              "self": "https://xxxxxxxxx.atlassian.net/wiki/rest/api/content/XXXXXXXXX/property/key-example"
            }
          },
          {
            "id": "XXXXXXXXXXXX-different",
            "key": "key-example",
            "value": [],
            "version": {
              "when": "2019-10-20T11:33:43.948Z",
              "message": "",
              "number": 1,
              "minorEdit": false
            },
            "_expandable": {
              "content": "/rest/api/content/XXXXXXXXX"
            },
            "_links": {
              "self": "https://xxxxxxx.atlassian.net/wiki/rest/api/content/XXXXXXXXXX/property/key-example"
            }
          }
      }
      

      Steps to Reproduce

      1. Prepare a Create content property API request as a curl command, for example: 

      curl --location 'https://<mycoolsitename>.atlassian.net/wiki/rest/api/content/<contentId>/property' \
      --header 'Authorization: Basic <redacted>' \
      --header 'Content-Type: application/json' \
      --data '{
              "key": "key1",
              "value": "value1"
      }' 

      2. Run two (or more) of these same commands from a Terminal window in parallel using an '&' between them: 

      $ curl <args> & curl <args>
      

      3. Retrieve properties for the <contentId> using Get content properties API.

       

      The issue is reproducible with Create page property Gen2 API as well.

      Expected Results

      No content properties with duplicate keys are found.

      Actual Results

      There are multiple of content properties with a duplicate key.

      Workaround

      As per Ryan's comment:

      If you need the latest property with a particular key, use "Get content properties" to get ALL content properties, and get the content property you need from there with the highest version number.

              0c24083ecc21 Miyo Imai
              dmorrow@atlassian.com Dugald Morrow
              Votes:
              21 Vote for this issue
              Watchers:
              26 Start watching this issue

                Created:
                Updated:
                Resolved: