Skip to content Skip to sidebar Skip to footer

How To Post A Pull Request Comment Using Bitbucket Api In Python?

I am trying to add comment to bitbucket pull request through REST API. Response I get is 404 always First I tried with python requests library, then curl command #python code link

Solution 1:

I found the solution with Bitbucket REST API 1.0 version.

The API format is as follows:-

  • /rest/api/1.0/projects//repos//pull-requests//comments.

Python code used to add comment:

importrequestsheaders= {'content-type': 'application/json'}

commentLink = 'https://base-url//rest/api/1.0/projects/<project_name>/repos/<repo_name>/pull-requests/<pull_request_id>/comments'
res = requests.post(commentLink, verify=False, auth=(username,password), headers=headers, data=json.dumps({'text': <comment>}))

Reference to API : Link

Post a Comment for "How To Post A Pull Request Comment Using Bitbucket Api In Python?"