Gitlab API, Merge When Build Succeeds

Hi!

I’d like to set the merge_when_build_succeeds attribute of a merge request with the Gitlab API. The docs says, that when the optional merged_when_build_succeeds parameter is true, the MR’ll be accepted only after the build succeeds.

How should I provide this merged_when_build_succeeds parameter to the API? I tried the following curl commands without any success:

# In the request's body
vilmosnagy@vnagy-dell:~$ curl -X PUT --header "PRIVATE-TOKEN: zvzK7CNzx9WviV5iChyg" -d merged_when_build_succeeds=true "http://localhost:8080/api/v3/projects/1/merge_requests/9/merge"
{"message":"405 Method Not Allowed"}

# In the URL
vilmosnagy@vnagy-dell:~$ curl -X PUT --header "PRIVATE-TOKEN: zvzK7CNzx9WviV5iChyg" "http://localhost:8080/api/v3/projects/1/merge_requests/9/merge?merged_when_build_succeeds=true"
{"message":"405 Method Not Allowed"}

# I tried this also, maybe the __merged__ is a mistake in the docs
vilmosnagy@vnagy-dell:~$ curl -X PUT --header "PRIVATE-TOKEN: zvzK7CNzx9WviV5iChyg" -d merge_when_build_succeeds=true "http://localhost:8080/api/v3/projects/1/merge_requests/9/merge"
{"message":"405 Method Not Allowed"}

# In the URL
vilmosnagy@vnagy-dell:~$ curl -X PUT --header "PRIVATE-TOKEN: zvzK7CNzx9WviV5iChyg" "http://localhost:8080/api/v3/projects/1/merge_requests/9/merge?merge_when_build_succeeds=true"
{"message":"405 Method Not Allowed"}

# Some other CURL parameters
vilmosnagy@vnagy-dell:~$ curl -X PUT --header "PRIVATE-TOKEN: zvzK7CNzx9WviV5iChyg" -H "Content-Type: multipart/form-data;" -F "merge_when_build_succeeds=true" "http://localhost:8080/api/v3/projects/1/merge_requests/9/merge"
{"message":"405 Method Not Allowed"}

# Some other CURL parameters
vilmosnagy@vnagy-dell:~$ curl -X PUT --header "PRIVATE-TOKEN: zvzK7CNzx9WviV5iChyg" -H "Content-Type: multipart/form-data;" -F "merged_when_build_succeeds=true" "http://localhost:8080/api/v3/projects/1/merge_requests/9/merge"
{"message":"405 Method Not Allowed"}

The new feature, ‘Only allow merge requests to be merged if the build succeeds’ is turned on. When I turn off this feature any call of the previous calls merge the MR before the build finished, see: https://snag.gy/06nOEm.jpg

The private token, and the URL is right. I can query the MR’s info:

vilmosnagy@vnagy-dell:~$ curl -X GET --header "PRIVATE-TOKEN: zvzK7CNzx9WviV5iChyg" "http://localhost:8080/api/v3/projects/1/merge_requests/9"
{"id":9,"iid":9,"project_id":1,"title":"enters","description":"","state":"opened","created_at":"2016-06-29T15:36:15.235Z","updated_at":"2016-06-29T15:36:15.235Z","target_branch":"master","source_branch":"features/long_build_05","upvotes":0,"downvotes":0,"author":{"name":"Vilmos Nagy","username":"vilmos.nagy","id":2,"state":"active","avatar_url":"http://www.gravatar.com/avatar/4f94d9571ec83f42a85651291296f503?s=80\u0026d=identicon","web_url":"http://172.21.0.3/u/vilmos.nagy"},"assignee":null,"source_project_id":2,"target_project_id":1,"labels":[],"work_in_progress":false,"milestone":null,"merge_when_build_succeeds":false,"merge_status":"can_be_merged","subscribed":false,"user_notes_count":0}

And I can accept the MR after the build succeeds:

vilmosnagy@vnagy-dell:~$ curl -X PUT --header "PRIVATE-TOKEN: zvzK7CNzx9WviV5iChyg" "http://localhost:8080/api/v3/projects/1/merge_requests/9/merge"
{"id":9,"iid":9,"project_id":1,"title":"enters","description":"","state":"merged","created_at":"2016-06-29T15:36:15.235Z","updated_at":"2016-06-29T16:13:41.242Z","target_branch":"master","source_branch":"features/long_build_05","upvotes":0,"downvotes":0,"author":{"name":"Vilmos Nagy","username":"vilmos.nagy","id":2,"state":"active","avatar_url":"http://www.gravatar.com/avatar/4f94d9571ec83f42a85651291296f503?s=80\u0026d=identicon","web_url":"http://172.21.0.3/u/vilmos.nagy"},"assignee":null,"source_project_id":2,"target_project_id":1,"labels":[],"work_in_progress":false,"milestone":null,"merge_when_build_succeeds":false,"merge_status":"can_be_merged","subscribed":true,"user_notes_count":0}

Could you help me, and give me the correct call of the given API?

Thanks!

Vilmos