Uploaded image for project: 'REST Client'
  1. REST Client
  2. MGNLRESTCL-47

Asynchronous REST calls from templates

    XMLWordPrintable

Details

    • Story
    • Resolution: Unresolved
    • Neutral
    • None
    • None
    • None
    • None
    • Yes
    • Yes
    • Phase 2

    Description

      As a template developer I want to make asynchronous calls to REST endpoints in my template and also include the results asynchronously, so that I can use both local and external content in my web experiences, in an efficient manner.

      For Example:

      Some content is of secondary importance such as offers and promotions. Even if the external system where you are getting the promos is slow to respond, you still want to render the primary content of your site immediately. The promos can show a loading indicator and then load later.

      Acceptance Criteria:

      • REST calls are performed from the server so that credentials are not exposed and to avoid problems with CORS.
      • Easy pattern to follow.
      • Errors in the REST response are handled gracefully.

      NOTE: This does not require a change to the rendering pipeline. Could maybe be resolved by documentation and examples.

      Possible approach: Component renders a loading indicator and includes javascript to make an ajax request to another variant of itself using Direct Component Rendering and a different file extension. When this variant of the component is requested (via this file extension), it then makes the normal synchronous restfn call and renders itself (either as JSON or HTML depending on the usecase). When this rendering is returned to the JS that made the AJAX request, either the JS creates some markup based on the returned JSON, or the pre-rendered HTML is injected in the DOM.

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                Unassigned Unassigned
                czimmermann Christopher Zimmermann
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                  Created:
                  Updated:

                  Checklists

                    Task DoD