Uploaded image for project: 'Magnolia REST Framework'
  1. Magnolia REST Framework
  2. MGNLREST-625

Combine template-annotations with Delivery API responses

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Neutral Neutral
    • None
    • None
    • None
    • None

      Now for Visual SPA to work, we need to fetch extra data from `template-annotations` endpoint. It is manageable but does add extra complexity to the code.

      get page content
      
      if in magnolia
        fetch template-annotations
      
      pass data to editable page

      What if we return template annotations data in the response from Delivery API?

      {
        "@name": "home",
        "@path": "/home",
        "templateAnnotation": ""cms:page ...",
        ...
        "main": {
          "@path": "/home/main",
          "templateAnnotation": ""cms:area ...",
          ...
          "0": {
            "@path": "/home/main/0",
            "templateAnnotation": ""cms:component ...",
            ...
          }
        }
      }

      We could simplify the code to:

      get page content
      
      pass data to editable page

      How would Delivery API know to fetch those extra data? Query params that Magnolia already adds to iframe src.
      We already do:

      get page content // add all query param from page request
      
      pass data to editable page

      This is just a basic case, so it might seem simple, but it gets more tricky when we bring in the p13n and multiple workspaces (sales demo).

      Currently, we must:

      • define new template annotations endpoints for multiple workspaces
      • ensure they use the new implementation class
      • JS needs to guess if it opens in the context of Pages App or Campain App or any other app using different workspaces and chose a correct template annotations url. It changes 2 lines of code into 50

       

        Acceptance criteria

              Unassigned Unassigned
              bstaryga Bartosz Staryga
              DeveloperX
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:

                  Task DoD