Uploaded image for project: 'Magnolia REST Client UI'
  1. Magnolia REST Client UI
  2. MGNLRESTUI-16

A wrapper for YAML expressions in RestClientResultSupplierDefinition

    XMLWordPrintable

Details

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

    Description

      Some APIs (Confluence's for instance) don't return a full URL link in the response, just its fragment such as the path, making it difficult to use it as a functioning link in the Find Bar results. See the webui property in the following response:

      {
         "results":[
            {
               "id":"173020719",
               "type":"page",
               "status":"current",
               "title":"Part II - Fine-tuning a basic content app",
               "restrictions":{
      
               },
               "_links":{
                  "webui":"/display/DOCS61/Part+II+-+Fine-tuning+a+basic+content+app",
                  "tinyui":"/x/LxZQCg",
                  "self":"https://wiki.magnolia-cms.com/rest/api/content/173020719"
               },
               "_expandable":{
                  "container":"",
                  "metadata":"",
                  "extensions":"",
                  "operations":"",
                  "children":"",
                  "history":"/rest/api/content/173020719/history",
                  "ancestors":"",
                  "body":"",
                  "version":"",
                  "descendants":"",
                  "space":"/rest/api/space/DOCS61"
               }
            }
         ],
         "start":0,
         "limit":25,
         "size":1,
         "_links":{
            "self":"https://wiki.magnolia-cms.com/rest/api/content/search?cql=space=DOCS61%20AND%20text~libib",
            "base":"https://wiki.magnolia-cms.com",
            "context":""
         }
      }
       

      A wrapper functionality such as the templateUrl shown below would allow the user to bypass this issue.

      class: info.magnolia.rest.ui.periscope.RestClientResultSupplierDefinition
      restClient: magnolia-docs
      restCall: searchMgnlDocs61
      searchResultExpression:
        title: $..title
        url: $.._links.webui
        templateUrl: 'https://documentation.magnolia-cms.com{url}'
      

      The wrapper functionality could be implemented even for the title property and hence templateTitle so that I could customize even the result title shown in the Find Bar results area, that is to see, e.g.

      "Part II - Fine-tuning a basic content app (DOCS 6.1)"
      instead of just
      "Part II - Fine-tuning a basic content app"

      provided by the REST response.
       

      A more universal approach - not requiring an extra property for each expression - might look like this:

      class: info.magnolia.rest.ui.periscope.RestClientResultSupplierDefinition
      restClient: magnolia-docs
      restCall: searchMgnlDocs61
      searchResultExpression:
        title: {$..title}(DOCS 6.1)
        url: https://documentation.magnolia-cms.com{$.._links.webui}
      

       

       

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                Unassigned Unassigned
                mdrapela Martin Drápela
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                  Created:
                  Updated:

                  Checklists

                    Task DoD