Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-31192

The REST-API should work with javascript (JSONP)

    XMLWordPrintable

Details

    • We collect Confluence feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

    Description

      NOTE: This suggestion is for Confluence Server. Using Confluence Cloud? 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: