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

Bitbucket Cloud API "url" field does not accept spaces

    XMLWordPrintable

Details

    Description

      Summary

      When including spaces ("%20" / "+") within the URL field while perform an API request :

      #!bash
      curl -iX POST -u "$user:$password" -d url="http://test.com/test%20test" -d key=build -d state=INPROGRESS &#x27;https://api.bitbucket.org/2.0/repositories/<username>/<Reponame>/commit/46be58e746215a4d2baa5673711be563a531311f/statuses/build/&#x27;
      

      Bitbucket Cloud Returns with the error below:

      #!bash
      {"error": {"fields": {"url": ["Enter a valid URL."]}, "message": "Bad request"}}
      

      ###Expected Results

      • 201 Status Code (Able to add the build status successfully)

      Notes

      Have tested with removing the space and add other symbols (eg. &, %21 etc.) and manage to update the status build.

      Workaround

      Use Json format

      curl --request POST \
        --url https://api.bitbucket.org/2.0/repositories/<username>/<Reponame>/commit/46be58e746215a4d2baa5673711be563a531311f/statuses/build/ \
        ---u "$user:$password" \
        -d '{"url":"http://test.com/test%20test", "name":"test-build", "state":"SUCCESSFUL", "key":"test-space2" }'
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            rchia Ronald C.
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: