Uploaded image for project: 'Confluence Cloud'
  1. Confluence Cloud
  2. CONFCLOUD-31192

The REST-API should work with javascript (JSONP)

    XMLWordPrintable

Details

    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

    Description

      NOTE: This suggestion is for Confluence Cloud. Using Confluence Server? See the corresponding suggestion.

      The problem:

      When you use JSONP to access the REST-API you can't set the access header. And therefore Confluence returns the default XML document, witch can't be read by javascript when you do cross origin requests.

      How to reproduce the problem:

      1. open the attached confluenceRestFail.html file
      2. open the javascript console on you web browser
      3. see the error message because it can't interpret the "<" in the beginning of the XML document it gets back.

      Suggested fix:

      Confluence could use the jsonp-callback= GET parameter to set the return type to JSON instead of XML. Because the jsonp-callback= parameter is pretty useless for a xml request...

      Why you can't set the Accept header in javascript when using JSONP

      You can't set the access header because when you use JSONP the tool of you choice creates a <script> element and sets the "src" attribute to the URL you want. And you can't set a Accept: "application/json" on a <script> element. Therefore your Accept headers looks like this: Accept: */* and that in turn results in confluence returning XML.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              f91bc6109242 Karl Gustav
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: