How do I retrieve my custom variables from a Bamboo Atlassian Build Plan via REST API
<p>I have a bamboo plan that runs on every commit to a github pull request. In that bamboo plan there are a few custom variables on it such as Git Sha, Github Pull Request Number, etc. </p>

<p>I want to write a script that stops all previous builds (multiple concurrent builds) that have the same pull request number -- same custom variable value.</p>

<p>The reason for this is that if someone makes a quick change to their pull request (comments on the review, etc) that we don't have multiple builds running when only the last one is necessary.</p>

<p>I know it is possible to stop a build with a rest request, but I need a way to be able to get all running builds with custom variable value = 27 (pull request number). Once I know this, I can proceed.</p>