It's all about the answers!

Ask a question

Request a build via REST api

Luca Martinucci (1.0k396112) | 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.5k711) | answered Mar 28 '13, 10:29 a.m.
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":"","name":"addedProperty","value":"some value","description":"","isRequired":false,"isGenericEditAllowed":true}],"deletedProperties":[{"name":"deletedPropertyName"}]}

Luca Martinucci selected this answer as the correct answer

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

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.
Hi Luca,

This is discussed in another thread ...

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.


Your answer

Register or to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.