Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-11904

Bitbucket duplicates REST resource root path in WADL

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Low
    • None
    • 6.4.1, 6.6.0, 6.5.1
    • API - REST

    Description

      Summary

      The application.wadl file provided by the Bitbucket REST API duplicates the API path in both the resource base and the resource path, leading to an invalid URL.

      This also breaks integration with the Atlassian REST API Browser plugin making it provide wrong REST resource URLs.

      Steps to reproduce

      1. Access view-source:<BITBUCKET_URL>/rest/api/1.0/application.wadl

      Expected result

      <ns2:resource> elements don't contain "api/1.0/" prefix
      e.g.

          <ns2:resources base="https://test.mybitbucket.com/bitbucket/rest/api/1.0/">
              <ns2:resource path="projects/{projectKey}/repos">
      

      Actual result

      <ns2:resource> elements contains "api/1.0/" prefix
      e.g.

          <ns2:resources base="https://test.mybitbucket.com/bitbucket/rest/api/1.0/">
              <ns2:resource path="api/1.0/projects/{projectKey}/repos">
      

      Notes

      The duplicated "api/1.0/" prefix breaks integration with Atlassian REST API Browser plugin making it provide wrong REST resource URLs.

      Workaround

      Implement a URL rewrite on a reverse proxy to redirect URLs made using the partially duplicated paths over to the actual, correct, path. Something akin to matching the following regex:

      • ^/rest/api/([0-9][.]?[0-9]?)/api/[0-9][.]?[0-9]?/(.*)$

      And then replacing it with:

      • /rest/api/$1/$2

      Note: If you're using a context path, make sure to include that in the URL rewrite - both in the matching regex, and the redirect value as well

      While this workaround doesn't affect the incorrect display in the WADL file, it will ensure that any requests to the REST API will be redirected correctly to the same API; and allowing integrations using the WADL to function correctly (such as the REST API browser).

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              eslaughter@atlassian.com Evan Slaughter
              Votes:
              4 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Backbone Issue Sync