Getting grandchildren of a custom content with Get Content or Get Content Children By Type REST APIs returns empty list

XMLWordPrintable

    • Minor

      Issue Summary

      Assuming that there is a hierarchy of custom contents

      page:
      - custom content parent (ac:app:parent)
        - custom content child (ac:app:child)
          - custom content grandchild (ac:app:child)

       grandchildren are not returned when calling a Get Content REST API with children expansion or Get Content Children By Type for the child custom content.

      Steps to Reproduce

      Having the following custom content types configured (in atlassian-connect.json)

      "customContent": [
          {
              "key": "parent",
              "name": {
                  "value": "Parent"
              },
              "apiSupport": {
                 "supportedContainerTypes": [
                     "page"
                 ],
                 "supportedChildTypes": [
                     "ac:my-app:child"
                 ],
                 // ...
              }
          },
          {
              "key": "child",
              "name": {
                  "value": "child"
              },
              "apiSupport": {
                  "supportedContainerTypes": [
                      "ac:my-app:parent",
                      "ac:my-app:child"
                  ],
                  "supportedChildTypes": [
                      "ac:my-app:child"
                  ],
                  // ...
              }
          }
      ]
      
      1. Create a hierarchy of custom content as shown in issue summary. It can be done through a Create Content REST API (POST to rest/api/content) using the following request bodies. You have to use undocumented container parameter to specify a container page for parent custom content, container parent custom content for child custom component and so on.
        {
            "type": "ac:my-app:parent",
            "title": "Custom Component Parent",
            "container": {
                "type": "page"
                "id": "<page-id>"
            },
            "space":{
                "key": "MYSPACEKEY"
            },
            "body":{
                "storage": {
                    "value": "Custom Component Parent body",
                    "representation": "storage"
                }
            }
        }
        
        {
            "type": "ac:my-app:child",
            "title": "Custom Component Child",
            "container": {
                "type": "ac:my-app:parent"
                "id": "<parent-custom-content-id>"
            },
            "space":{
                "key": "MYSPACEKEY"
            },
            "body":{
                "storage": {
                    "value": "Custom Component Child body",
                    "representation": "storage"
                }
            }
        }
      1. Use GET request to Get Content (with expand) and Get Content Children By Type REST APIs to get a list of grandchildren
        {{baseurl}}/rest/api/content/<child-id>?expand=children.ac__my_app__child
        {{baseurl}}/rest/api/content/<child-id>/child/ac:my-app:child

      Expected Results

      Both APIs return a list of grandchildren.

      Actual Results

      The returned list is empty

      Workaround

      Look up grandchild content id in the CONTENT table in the database

      select contentid, title from content where contenttype = 'CUSTOM' and pageid = '<child-id>';
      

      Get the returned content id and use Get Content REST API to get the grandchild content

      {{baseurl}}/rest/api/content/<grandchildchild-id>
      

       

            Assignee:
            Unassigned
            Reporter:
            Roman Toropov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: