Triggering CI via API with commit sha

I am able to trigger builds via the API using branch names (master) fine, just as the docs at https://docs.gitlab.com/ce/ci/triggers/README.html show:

curl --request POST --form token=tok3n --form ref=master http://server.com/api/v3/projects/2/trigger/builds --form "variables[BUILD_RECIPE]=frank"

However, if I try to replace master with a commit sha, I only get code 401: {“message”:“No builds created”}

curl --request POST --form token=tok3n --form ref=3814a2c2c5f59372acd8402e7601be0ce233a0f8 http://server.com/api/v3/projects/2/trigger/builds --form "variables[BUILD_RECIPE]=frank"

Is there another syntax to specify ref as a commit sha?

Edit: this is with gitlab omnibus 8.12.2; gitlab api v3

Figured this out. You need to also pass the sha as a separate entity in the form:

curl --request POST --form token=tok3n --form ref=master --form sha=3814a2c2c5f59372acd8402e7601be0ce233a0f8 http://server.com/api/v3/projects/2/trigger/builds --form "variables[BUILD_RECIPE]=frank"

Could an example be added to the docs? I’m happy to put up a PR/MR if you point me in the right direction.