Uploaded image for project: 'Bitbucket Cloud'
  1. Bitbucket Cloud
  2. BCLOUD-8910

API 400 Error responses should be in JSON, not HTML

    XMLWordPrintable

Details

    Description

      400 error responses are currently returned as difficult-to-parse HTML:

      #!html
      
      <ul class="errorlist">
        <li>name
          <ul class="errorlist"><li>You already have a repository with this name.</li></ul>
        </li>
      </ul>
      

      It stands to reason that json should be the default response type, since the response type for successful API calls is also json.

      At the very least, the API should respect the Accept: header in the request. For example, if I send a request with the header "Accept: application/json", the API should know I want json and return that.

      #!json
      
      {
          "errorlist": [
              {"name": ["You already have a repository with that name"]}
          ]
      }
      

      Attachments

        Activity

          People

            jmooring moo (Inactive)
            62fed3546745 bendavis78
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: