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

The deployments API endpoint returns an invalid "next" field with an ampersand instead of question mark

XMLWordPrintable

      Issue Summary

      When using the following API endpoint for a repo that has more than 10 deployments, the returned JSON object contains a malformed URL under the "next" field. If used as-is, the subsequent query will fail.

      https://developer.atlassian.com/cloud/bitbucket/rest/api-group-deployments/#api-repositories-workspace-repo-slug-deployments-get

      The url in "next" has an ampersand & instead of a question mark ? before the page query.

      Steps to Reproduce

      1. Make an API call with that endpoint for a repo that has more than 10 deployments
      2. Observe the "next" URL in the output

      Expected Results

      The "next" URL is valid, and running an API call for it should return the next page of results.

      Actual Results

      The "next" URL is invalid. Instead of a question mark "?" before the page query, there is an ampersand "&":

      "next": "https://api.bitbucket.org/2.0/repositories/%7B{workspace-guid}%7D/%7B\{repository-guid}%7D/deployments/&page=2&pagelen=10"
      

      Running an API call with this returns an "HTTP 400 Bad Request" error.

      Workaround

      Edit the "next" URL and replace the ampersand before page with a question mark:

      https://api.bitbucket.org/2.0/repositories/%7B]{workspace-guid}%7D/%7B{repository-guid}%7D/deployments/?page=2&pagelen=10
      

              Unassigned Unassigned
              tboudale Theodora Boudale (Inactive)
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated: