Get custom content versions API endpoint fails for ADF format when bodyType doesn't match definition from app descriptor/yaml

XMLWordPrintable

    • 1
    • Severity 3 - Minor

      Issue Summary

      When calling Get custom content versions for a custom content record that has its bodyType in the database different from what was defined in the Connect/Forge app responsible for that custom type, it will result in a 500 Internal Server Error if the body-format=atlas_doc_format query parameter is used.

      This scenario appears to be more common when third-party apps are converted from Connect to Forge apps, and change the bodyType use for their custom content in the process (either storage or raw). The legacy content remains as the older type, while the new custom content is created with the updated bodytype.

      When passing the ADF format as desired body-format, the app seems to fall back to the default bodyType that was defined in the Connect app Descriptor / Forge app YAML. If that doesn't match the value in the database, a 415 UNSUPPORTED_MEDIA_TYPE error occurs, followed by a 500 Internal Server Error response.

      Steps to Reproduce

      1. Use a custom app to create custom content with bodyType=storage
      2. Create some custom content records from that app
      3. Update the app to use a different bodyType (raw) for its custom content
      4. Make a request to /wiki/api/v2/custom-content/{contentId}/versions?body-format=atlas_doc_format, where {contentid} is any of the records created in step 2.

      Expected Results

      A regular endpoint response (sample from API doc)

      {
        "results": [
          {
            "createdAt": "<string>",
            "message": "<string>",
            "number": 1,
            "minorEdit": true,
            "authorId": "<string>",
            "custom": {
              "title": "<string>",
              "id": "<string>",
              "body": {}
            }
          }
        ],
        "_links": {
          "next": "<string>",
          "base": "<string>"
        }
      }

       

      Actual Results

      500 Internal Server Error

      Workaround

      Currently, the workaround is limited to either not using the body-format=atlas_doc_format query parameter for the request (which may not be feasible in certain cases) or trying to update the affected custom type record (creating a new version of it may get the proper/updated value for bodyType).

            Assignee:
            Andrew W.
            Reporter:
            Rodrigo Bozza (Atlassian)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: