title: Check Jenkins job status after triggering a build remotely
body: <p>I have a script to trigger a job on Jenkins remotely using a token. Here is my script:</p>
  
  <pre><code>JENKINS_URL='http://jenkins.myserver.com/jenkins'
  JOB_NAME='job/utilities/job/my_job'
  JOB_TOKEN='my_token'
  
  curl "${JENKINS_URL}/${JOB_NAME}/buildWithParameters?token=${JOB_TOKEN}"
  </code></pre>
  
  <p><strong>After I run it, I get following response:</strong></p>
  
  <pre><code>* Hostname was NOT found in DNS cache
  *   Trying 10.5.187.225...
  * Connected to jenkins.myserver.com (10.5.187.225) port 80 (#0)
  &gt; GET /jenkins/job/utilities/job/my_job/buildWithParameters?token=my_token HTTP/1.1
  &gt; User-Agent: curl/7.37.1
  &gt; Host: jenkins.myserver.com
  &gt; Accept: */*
  &gt; 
  &lt; HTTP/1.1 201 Created
  * Server nginx/1.6.2 is not blacklisted
  &lt; Server: nginx/1.6.2
  &lt; Date: Tue, 03 Feb 2015 23:40:47 GMT
  &lt; Content-Length: 0
  &lt; Location: http://jenkins.myserver.com/jenkins/queue/item/91/
  &lt; Connection: keep-alive
  &lt; Cache-Control: private
  &lt; Expires: Wed, 31 Dec 1969 16:00:00 PST
  &lt; 
  * Connection #0 to host jenkins.myserver.com left intact
  </code></pre>
  
  <p>I noticed that it returns the queue url in the header: <a href="http://jenkins.myserver.com/jenkins/queue/item/91" rel="noreferrer">http://jenkins.myserver.com/jenkins/queue/item/91</a>. But I don't know how I should use this return url.</p>
  
  <p>1) I am wondering if anyone knows how I can check the status for the job that I just created?</p>
  
  <p>2) Since the above response does not return the job #, I can't really use this api call: </p>
  
  <pre><code>curl http://jenkins.myserver.com/jenkins/job/utilities/job/my_job/8/api/json
  </code></pre>
  
  <p>to check for status. So where can I get the job name and job number after I get the location url from the above response?</p>
  
  <p>Thanks</p>