Details
-
Bug
-
Resolution: Answered
-
Medium
-
1
-
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 'https://api.bitbucket.org/2.0/repositories/<username>/<Reponame>/commit/46be58e746215a4d2baa5673711be563a531311f/statuses/build/'
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" }'