Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Create, update and list issues from Bitbucket API V2 using CURL

Set variables

export user=my_user_email
export password=my_password
export org=my_org_or_my_user
export repo=my_repo_name

Create issue with CURL

curl --user $user:$password -X POST -H "Content-Type: application/json" \
"https://api.bitbucket.org/2.0/repositories/"$org"/"$repo"/issues" \
--data '{"title":"title of the issue","content":{ "raw":"this should be the description"}, "fields": {"assignee": {"username": "ThomasG77"}}}'

Update issue changing title and assignee

curl "https://api.bitbucket.org/2.0/repositories/"$org"/"$repo"/issues/95" \
  --user $user:$password -X PUT -H 'Content-Type: application/json' \
  -d '{
  "title": "Updated title 1",
  "assignee": {
    "username": "ThomasG77"
  }
}'

List existing issues

curl --user $user:$password "https://api.bitbucket.org/2.0/repositories/"$org"/"$repo"/issues"

For using the API further

Finding the right entry was not so simple, so to keep in memory...

https://developer.atlassian.com/bitbucket/api/2/reference/resource/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.