Issue #10237 resolved

API for merge pull request is not working / not consistent with the doc

Dong Xu
created an issue

The document here says that the API for merging a pull request is{owner}/{repo_slug}/pullrequests/{pull_request_id}/merge.

However, this comment said the API is

Notice the last parts of the two different urls.

In REST API browser, /merge is not even there, but /accept will return the following error:

  "error":  {
    "message": "Resource not found",
    "detail": "There is no API hosted at this URL.\n\nFor information about our API's, please refer to the documentation at:"

If you nevertheless try to use /merge API, you will get the following error:

  "error":  {
    "message": "name, email or commit message not provided",
    "detail": "  File "/opt/python/domains/", line 208, in __call__\n    result = checked_meth(request, *args, **kwargs)\n  File "/opt/python/domains/", line 195, in checked_meth\n    return meth(*args, **kwargs)\n  File "/opt/python/domains/", line 33, in __call__\n    return self._nr_wrapped(*args, **kwargs)\n  File "/opt/python/domains/", line 38, in wrap\n    return f(request, *a, **kwa)\n  File "/opt/python/domains/", line 375, in wrapped_function\n    return func(*args, **kwargs)\n  File "/opt/python/domains/", line 78, in wrapped_function\n    return func(*args, **kwargs)\n  File "/opt/python/domains/", line 206, in wrapper\n    return f(self, request, *args, **kwargs)\n  File "/opt/python/domains/", line 35, in wrapper\n    val = func(self, request, *args, **kwargs)\n  File "/opt/python/domains/", line 328, in create\n    return\n  File "/opt/python/domains/", line 688, in save\n    self._merge()\n  File "/opt/python/domains/", line 655, in _merge\n    closebranch=self.instance.close_anchor_branch)\n  File "/opt/python/domains/", line 61, in merge\n    destinationhead=destcset)\n  File "/opt/python/domains/", line 1446, in merge\n    fastforward=fastforward)\n  File "/opt/python/domains/", line 500, in pull\n    fastforward=fastforward)\n  File "/opt/python/domains/", line 552, in fetchandmerge\n    localmarker=localmarker, remotemarker=remotemarker, force=force)\n  File "/opt/python/domains/", line 581, in _fetchandmerge\n    (destcset, incomingcset), user, text, date)\n  File "/opt/python/domains/", line 195, in commit\n    raise CommitError('name, email or commit message not provided')\n",
    "id": "f292da4c27624698a8ee8847e123019d"

The doc says that only owner, repo_slug, and pull_request_id are required fields.

The inconsistency between the API and the doc is very frustrating. I am missing something very important?

Comments (3)

  1. Erik van Zijst staff

    That comment is outdated and wrong. I have updated it. The correct way to merge a PR is /merge (as per the links element in the pull request json document).

    Thanks for pointing this out!

  2. Joe DeCapo

    This issue doesn't appear to be resolved. I'm trying to use the pull request REST API to merge a pull request, and I'm getting the same error mentioned above, "name, email, or commit message not provided"

  3. Log in to comment