Error message response from Rest APIs should be in JSON or support JSON

XMLWordPrintable

    • 0

      PROBLEM STATEMENT

      Error response for some of the Jira APIs is in HTML format, rather then JSON. This behaviour forces the client applications to implement response handling i.e. identify the type of API response and then parse JSON or HTML accordingly.

      For eg. calling  search endpoint POST /ex/jira/<cloud-id>/rest/api/2/search/jql via OAuth 3LO - i.e., the request is made via 3LO OAuth connection, not from a Forge or Connect app, may result in 403 error as shared below, with an html response.

       

      content-type: text/html;charset=UTF-8
      transfer-encoding: chunked
      connection: keep-alive
      date: Fri, 14 Mar 2025 04:21:34 GMT
      server: AtlassianEdge
      timing-allow-origin: *
      x-arequestid: <removed>
      x-trace-id: <removed>
      x-frame-options: SameOrigin
      x-content-type-options: nosniff
      x-xss-protection: 1; mode=block
      atl-traceid: <removed>
      atl-request-id: <removed>
      strict-transport-security: max-age=63072000; preload
      report-to: {"endpoints": [{"url": "https://<removed>.cloudfront.net"}], "group": "endpoint-1", "include_subdomains": true, "max_age": 600}
      nel: {"failure_fraction": 0.001, "include_subdomains": true, "max_age": 600, "report_to": "endpoint-1"}
      server-timing: atl-edge;dur=686,atl-edge-internal;dur=3,atl-edge-upstream;dur=684,atl-edge-pop;desc="aws-us-west-2"
      x-cache: Error from cloudfront
      via: 1.1 <removed>.cloudfront.net (CloudFront)
      x-amz-cf-pop: DEN52-P1
      x-amz-cf-id: <removed>
      <html> <head> <title>Forbidden (403)</title> <!--[if IE]><![endif]--> <script type="text/javascript" > var contextPath = ''; var DeferScripts = { deferState: 'disabled' }; </script> <script> window.WRM=window.WRM||{};window.WRM._unparsedData=window.WRM._unparsedData||{};window.WRM._unparsedErrors=window.WRM._unparsedErrors||{}; WRM._unparsedData["com.atlassian.plugins.atlassian-plugins-webresource-plugin:context-path.context-path"]="\"\""; ... // truncated due to content size limit of the JSM request window.WRM=window.WRM||{};window.WRM._unparsedData=window.WRM._unparsedData||{};window.WRM._unparsedErrors=window.WRM._unparsedErrors||{}; WRM._unparsedData["_wrmBatchContents"]="{\"js\":{},\"css\":{\"jira.global.look-and-feel,-_super\":[\"jira.webresources:jira-lookandfeel-all.lf-adg3\",\"jira.webresources:look-and-feel-affected-styles-all\",\"_context:jira.global.look-and-feel\"]}}"; if(window.WRM._dataArrived)window.WRM._dataArrived();</script> <meta name="application-name" content="JIRA" data-name="jira" data-version="1001.0.0-SNAPSHOT"> </head> <body id="jira" class="aui-layout aui-style-default page-type-message" data-version="1001.0.0-SNAPSHOT" > <div class="aui-page-panel"><div class="aui-page-panel-inner"> <section class="aui-page-panel-content"> <header class="aui-page-header"><div class="aui-page-header-inner"> <div class="aui-page-header-main"> <h1>Forbidden (403)</h1> </div><!-- .aui-page-header-main --> </div><!-- .aui-page-header-inner --></header><!-- .aui-page-header --> <div class="aui-message aui-message-warning warning"> <p>Encountered a <code>&quot;403 - Forbidden&quot;</code> error while loading this page.</p> <p><a href="/secure/MyJiraHome.jspa">Go to Jira home</a></p> </div> </section><!-- .aui-page-panel-content --> </div><!-- .aui-page-panel-inner --></div><!-- .aui-page-panel --> </body> </html>
      

      ASK

      Having all the API response in JSON or having the option to request for JSON response would be acceptable solution

            Assignee:
            Unassigned
            Reporter:
            Faisal
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: