It's all about the answers!

Ask a question

Request a build via REST api


Luca Martinucci (70027095) | asked Mar 28 '13, 5:45 a.m.
I would like to be able to request a build execution via REST api.
I'd like also to programmatically, still via REST api, set the build definition properties, before requesting the build.
Is this possible in RTC version 4.x?
Can anybody provide some sample pieces of code?
Thanks in advance.

Accepted answer


permanent link
Nick Edgar (6.5k611) | answered Mar 28 '13, 10:29 a.m.
JAZZ DEVELOPER
Luca, can you provide more details about your use case?  Does it have to be via REST or could you use the Java client API too?  The REST interface that supports the Build web UI does support issuing build requests, including overriding / removing build properties (but not configuration element properties).  Changing the build definition is also possible, but I'm guessing you only want to do that per-request.

Try looking at the HTTP request issued when you request a build via the web UI, using Firebug or whatever your favourite web debug tool is. e.g. if I request a build for definition with id "somedefinition", and adding one property and removing another, it should do a POST with:
url: <repo>/resource/virtual/build/requests
headers: Accept: text/json, Content-Type: text/json;charset=UTF-8
body: {"definition":"somedefinition","allowDuplicateRequests":true,"newOrModifiedProperties":[{"kind":"com.ibm.team.build.property.string","name":"addedProperty","value":"some value","description":"","isRequired":false,"isGenericEditAllowed":true}],"deletedProperties":[{"name":"deletedPropertyName"}]}

Luca Martinucci selected this answer as the correct answer

Comments
Nick Edgar commented Mar 28 '13, 10:31 a.m.
JAZZ DEVELOPER

Note that the Build REST interface is internal, though, not API, so it may change at any time.  That said, it has been pretty stable between releases, and we try not to make gratuitous changes. 

2 other answers



permanent link
Scott Cowan (966310) | answered Mar 28 '13, 10:14 a.m.
JAZZ DEVELOPER
Hi Luca,

This is discussed in another thread ... https://jazz.net/forum/questions/26893/build-rest-api?redirect=%2Fforum%2Fquestions%2F26893%2Fbuild-rest-api.

The story Nick references is resolved now, but it's unclear to me if an API was ever documented.  I'll get Nick to chime in here.

Scott

Your answer


Register or to post your answer.