Skip to content

Instantly share code, notes, and snippets.

@ThomasG77
Last active February 24, 2020 19:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ThomasG77/88a6af2b1d9a22a88d1e1e82a85e6055 to your computer and use it in GitHub Desktop.
Save ThomasG77/88a6af2b1d9a22a88d1e1e82a85e6055 to your computer and use it in GitHub Desktop.
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