title: How to get build custom variables/ environment variables using Jenkins REST API?
body: <p>I am able to get build job details using Jenkins REST API URL. That is, build status, release date, build parameters' values etc. (refer below example #1).</p>
  <p><strong>Example #1 - URL to get build details</strong></p>
  <hr />
  <p><em>http://jenkins-server/jenkins/view/tagname/api/xml?tree=jobs[builds[fullDisplayName,number,duration,timestamp,result]]&amp;wrapper=freeStyleProject&amp;depth=2&amp;xpath=listView/job/build[result = &quot;SUCCESS&quot;]</em></p>
  <p>Whereas I need to get custom variables/ environmental variables set in build steps during job execution through Jenkins.
  Say for example, if I set an environmental variable &quot;CC_MAIL_ID&quot; in build step, then I want to get that as follow.</p>
  <p><strong>Example #2 -  to get an environmental variable &quot;CC_MAIL_ID&quot; (added CC_MAIL_ID in the URL)</strong></p>
  <hr />
  <p><em>http://jenkins-server/jenkins/view/tagname/api/xml?tree=jobs[builds[fullDisplayName,number,duration,timestamp,result,CC_MAIL_ID]]&amp;wrapper=freeStyleProject&amp;depth=2&amp;xpath=listView/job/build[result = &quot;SUCCESS&quot;]</em></p>
  <p>How to achieve it?</p>