Nick:
If you're using Git and Gerrit, then you can find the branch and sha1 under "actions" and "parameters" as name/value pairs, with name of "GERRIT_BRANCH" and "GERRIT_PATCHSET_REVISION". I don't know of a way to find the specific build except to walk a project's builds until you find it.
So, to be clear:
- Start at http://jenkins_url/job/project_name/api/json?pretty=true
- Find the array of "builds", each element of which contains a key/value pair of "url" and the URL you need to visit
- E.g. a build URL will look like http://jenkins_url/job/project_name/build_number/api/json?pretty=true
- Look for "actions" -> "parameters" -> "name" == "GERRIT_BRANCH"
I don't know of an easier way.
Regards,
Darrel V in NC