Build numbers don't get assigned to queued builds, and for good reason: Between QueueSorter, QueueTaskDispatcher, and plugins like Set Next Build Number, this is impossible to determine before actually starting the build. Then there's the issue of canceling queue items – they don't (and shouldn't) use up build numbers, which this change would necessitate (or result in wrong results, as a specific build number could be queued and canceled again multiple times).
However, there's an easy API solution that considers that issue when triggering builds.
Trigger the build and check the headers:
$ curl -i --netrc http:HTTP/1.1 201 Created
Date: Wed, 21 May 2014 16:37:58 GMT
Server: Jetty(8.y.z-SNAPSHOT)
Location: http:Content-Length: 0
Connection: close
Content-Type: text/plain; charset=UTF-8
Get the Location value, and check its API at e.g. /queue/item/25/api/xml (formatted for readability):
<waitingItem>
<action>
<cause>
<shortDescription>Started by remote host xxx.xxx.xxx.xxx</shortDescription>
</cause>
</action>
<blocked>false</blocked>
<buildable>false</buildable>
<id>25</id>
<inQueueSince>1400690278070</inQueueSince>
<params/>
<stuck>false</stuck>
<task>
<name>triggerable-remotely</name>
<url>http: <color>blue</color>
</task>
<url>queue/item/25/</url>
<why>In the quiet period. Expires in 38 sec</why>
<timestamp>1400690328070</timestamp>
</waitingItem>
This contains all the information you could possibly want here. And once the build starts and a build number has finally been assigned, you get the build number and build URL:
<leftItem>
<action>
<cause>
<shortDescription>Started by remote host xxx.xxx.xxx.xxx</shortDescription>
</cause>
</action>
<blocked>false</blocked>
<buildable>false</buildable>
<id>25</id>
<inQueueSince>1400690278070</inQueueSince>
<params/>
<stuck>false</stuck>
<task>
<name>triggerable-remotely</name>
<url>http: <color>blue_anime</color>
</task>
<url>queue/item/25/</url>
<cancelled>false</cancelled>
<executable>
<number>6</number>
<url>http: </executable>
</leftItem>
As this feature is at least next to impossible to implement in a backwards compatible way, and has an easy, complete solution already, I'm resolving this as Won't Fix.
+1. Was about to post this on GG.
Hitting /build and /buildWithParameters really needs to return some type of data so we know the call was received and kicked off properly.
To start:
Build Number
Parameters
Time until it starts (If in queue)
I'm making calls currently and I've had it silently fail a few times and I don't have any way to tell if this is happening and try again