Github enterprise API delete branch after merge

Mat*_*ias 5 git curl github github-api

I am currently working with the Github API (on enterprise edition). After some trial and error I was able to change the status of a pull request using curl -X POST:

curl -u <token>:x-oauth-basic --header "Content-Type: application/json" -X POST --data "{\"state\":\"success\",\"target_url\":\"%BUILD_URL%\",\"description\":\"my description\",\"context\":\"continuous-integration/mycontext\"}" http://<server>/api/v3/repos/<myuserid>/<myreponame>/statuses/%COMMIT_SHA%
Run Code Online (Sandbox Code Playgroud)

and also to automatically merge if verything was successfull using curl -X PUT:

curl -u <token>:x-oauth-basic --header "Content-Type: application/json" -X PUT --data "{\"state\":\"merged\",\"commit_title\":\"automatic merge\",\"commit_message\":\"automatic merge\",\"sha\":\"%COMMIT_SHA%\",\"merge_method\":\"merge\"}" http://<server>/api/v3/repos/<myuserid>/<myreponame>/pulls/%PullRequest%/merge
Run Code Online (Sandbox Code Playgroud)

So far so good...But I am not able to delete the branch after successfull merge. I want to use the Github API, because the Jenkins job which is controlling this, does not know a thing about the repository or its branches.

What I tried was the following:

curl -u <token>:x-oauth-basic -X DELETE http://<server>/api/v3/repos/<myuserid>/<myreponame>/git/refs/heads/develop
Run Code Online (Sandbox Code Playgroud)

It returns:

{
  "message": "Not Found",
  "documentation_url": "https://developer.github.com/enterprise/2.11/v3/git/refs/#update-a-reference"
}
Run Code Online (Sandbox Code Playgroud)

The URL is fine from my perspective. Opened in a browser I get some nice JSON lines. My thought was, that I will not need JSON data this time, since I don't want to patch or create something, but rather "only" delete it. Am I right? What else might miss here?

Mat*_*ias 5

其实我的解决方案是正确的。我只有一个愚蠢的问题:授权用户不是我的分支上的合作者,因此不允许删除分支。恕我直言,这应该添加到文档中,因为它说如果找不到 refs,它只会给出 404 错误。